plotly_express
plotly_express copied to clipboard
Markes+lines don't work propertly with animation (plotly offline)
When you animate scatter plot with the mode 'Markes+lines', the line disapear during the animation.
plotly.version= '4.0.0'
Ex:
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.offline as offline
a=np.random.randn(10,3)
aa=a.T.flatten()
lines=np.arange(1,a.shape[1]+1)
xx=np.arange(a.shape[0])
lines2=np.tile(lines, (a.shape[0],1)).T.flatten()
myx=np.tile(xx, (1, a.shape[1])).flatten()
df1=pd.DataFrame(data=aa.flatten())
df2=pd.DataFrame(data=lines2)
df3=pd.DataFrame(data=myx)
df=pd.concat([df2,df1,df3], axis=1)
df.columns=['line','signal','x']
fig =(px.scatter(df, x="x", y="signal", animation_frame="line").update_traces(mode='lines+markers'))
offline.plot(fig, filename='test.html')