plotly / plotly_express

Plotly Express - Simple syntax for complex charts. Now integrated into plotly.py!
https://plot.ly/python/plotly-express/
MIT License
4 stars 0 forks source link

Color legend cannot show corresponding color (animated scatters) #79

Open MengyinZhong opened 5 years ago

MengyinZhong commented 5 years ago

@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

nicolaskruchten commented 5 years ago

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

brycedrennan commented 4 years ago

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.

SolsticeG commented 4 years ago

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.

ghost commented 3 years ago

@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