Hi @dpsugasa,
plotly.py/plotly.js won’t do so well if you represent each of 1000+ lines as individual traces. You’ll have much better luck if you group all of your lines (or at least all of your lines per color) into a single trace. This can be done by including nan values to separate your individual lines. I would also recommend using the scattergl trace types instead of scatter since scattergl is GPU optimized to handle much larger dataset sizes.
Here’s an example of plotting 1000 lines with 100 points each. Here representing 1000 trials of a 1D random walk for 100 iterations.
import numpy as np
import plotly.graph_objs as go
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()
N = 1000
# create list of the line segments you want to plot
all_xs = [np.arange(100, dtype='float64') for _ in range(N)]
all_ys = [(np.random.rand(100) - 0.5).cumsum() for _ in range(N)]
# append nan to each segment
all_xs_with_nan = [np.concatenate((xs, [np.nan])) for xs in all_xs]
all_ys_with_nan = [np.concatenate((ys, [np.nan])) for ys in all_ys]
# concatinate segments into single line
xs = np.concatenate(all_xs_with_nan)
ys = np.concatenate(all_ys_with_nan)
fig = go.Figure(data=[
go.Scattergl(x=xs, y=ys, mode='lines', opacity=0.05, line={'color': 'darkblue'})
])
iplot(fig)
Hope that helps!
-Jon
