plotly_express icon indicating copy to clipboard operation
plotly_express copied to clipboard

Color legend cannot show corresponding color (animated scatters)

Open MengyinZhong opened this issue 6 years ago • 4 comments

@nicolaskruchten Glad to meet you again:) I just found another problem: color legend cannot show corresponding color when the plot changes

Here is my data just cover two floors: the one was located at B2 between 17:30—18:10, and then it moved to B3. https://github.com/MengyinZhong/test/blob/master/color_legend_test.csv Could you help me to check that and it would be better if you could provide solution to fix it? Thx a lot~😃

  1. color legend always show floor=B2F even the dot color changed in the scatter plot. px.scatter(df, x="loc_x", y="loc_y", color="floor", range_x=[0,200], range_y=[0,100], animation_frame="per10m", category_orders={"floor": ["B3F","B2F", "B1F", "1F", "2F","3F","4F","5F"]}) scatter

  2. the color legend changed when plotting px.scatter_3d and px.line_3d, but scatter or line cannot show. px.scatter_3d(df, x="loc_x", y="loc_y", z="floorId", color="floor", animation_frame="per10m", hover_name="floor", range_x=[0,100], range_y=[0,100], range_z=[-3,5]) scatter3D

px.line_3d(df, x="loc_x", y="loc_y", z="floorId", color="floor", animation_frame="per10m", hover_name="floor", range_x=[0,100], range_y=[0,90], range_z=[-3,5], category_orders={"floor": ["B3F","B2F", "B1F", "1F", "2F","3F","4F","5F"]}) line3d

MengyinZhong avatar May 14 '19 09:05 MengyinZhong

Thanks for submitting this! I'm looking into it to see what we can do.

nicolaskruchten avatar May 20 '19 19:05 nicolaskruchten

I also experience this. Any "color" categories not in the first frame are excluded from all frames.

Similarly, the x and y range are set by the data in the first animation frame instead of all the data.

brycedrennan avatar Mar 05 '20 05:03 brycedrennan

I also experience this. Any "color" categories not in the first frame are excluded from all frames.

Similarly, the x and y range are set by the data in the first animation frame instead of all the data.

I also experienced this.

SolsticeG avatar Mar 24 '20 08:03 SolsticeG

@brycedrennan you can fix the x and y range yourself by using range_x and range_y when creating the px object. Example below where the bounds are set for each axis range.

fig = px.scatter(df, x='column1', y='column2', range_x=[0,120], range_y=[0,70])

As for the color categories only including those from the first frame - I am experiencing the same issue

ghost avatar Dec 06 '20 19:12 ghost