When I want to plot a line with many points, in some instances it is fast and the interactive features work fluently other times it is very slow and the interactivity is unresponsive. I placed two minimal working examples below with dummy data.
Am I missing something or is this the expected behaviour?
Fast:
import plotly.express as px
import pandas as pd
import numpy as np
np.random.seed(1)
N = int(1e6)
df = pd.DataFrame(dict(x=np.arange(N), y=np.random.randn(N)))
fig = px.line(df, x=‘x’, y=‘y’, render_mode=‘webgl’)
fig.show()
Slow:
import plotly.express as px
import pandas as pd
import numpy as np
np.random.seed(1)
N = int(1e6)
df = pd.DataFrame(dict(x=np.arange(N), y=np.arange(N)))
fig = px.line(df, x=‘x’, y=‘y’, render_mode=‘webgl’)
fig.show()