I have a 4D dataset with 3 dimensions describing the data and the fourth a time-index. Plotting the dataset as a scatterplot with colorcoding for the 3rd dimension works fine. When I try to animate it using the fourth dimension the color coding stops to work. As the chart should be easy to read, plot.ly is used for interaction with it.
Here the 3D approach:
import pandas as pd
import plotly.express as px
dat={'1.Value':[1,2,3,4,5,6,7,8,9],
'2.Value':[9,8,7,6,5,4,3,2,1],
'3.Value':[10,11,13,15,10,10,15,17,18],
'4.Value':[1,2,3,4,5,6,7,8,9]}
df = pd.DataFrame(data=dat)
fig = px.scatter(df, x="2.Value", y="3.Value",
color="4.Value" ,range_x=[0,20], range_y=[0,20]
)
fig.show()
And here the approach with animated time. Note that the colorcoding disappears:
fig = px.scatter(df, x="2.Value", y="3.Value", animation_frame="1.Value",
color="4.Value" ,range_x=[0,20], range_y=[0,20]
)
fig.show()
Does anyone have any whether this works at all and/or how it works. If it matters for the answer the code is executed in a jupyter notebook.
