🚀 Gen 5 of the leading AI app deployment platform launches October 6. Click for the livestream.

Strange Behavior of plotly express line graph

Hi,

I’m trying to draw line graphs with plotly express and the yellow bottom line connecting the initial point to the end suddenly appeared. There were no data points.

fig = px.line(data_frame=test,
x=‘Period’,
y=‘Body Weight’,
color=‘Gr. Category’,
line_shape=“spline”,
render_mode=“svg”,
color_discrete_sequence=px.colors.qualitative.G10
)
fig.update_xaxes(title=‘Period (weeks of age)’)
fig.update_yaxes(title=parameter_selected)
fig.update_traces(hoverinfo=‘text+name’, mode=‘lines+markers’)

fig.show()

I would like to draw the same line as a blue line. Does anyone have an idea to fix this?

Thank you

It seems like there are multiple series of data in Group 3… you can use the line_group parameter to split them up by some other variable if you’ve got one.

Thank you for your reply.

The thing is the Group 4 has the same number of data points and there were no additional lines connecting the initial points and the end points. This makes me feel puzzled.

If you look closely, Group 4 also has lines coming in and out of the final point, actually, to my eye at least.

That’s true. I did not notice it. I will try line_group with other variables.

Thank you