Reputation: 1
I plot a figure using this code. After playing this cell the program became too much slow and it is very hard to zoom the picture. How can I speed up this code? (consider that this code is not completed and in the coming updates I will need for loop, so I can not replace it)
fig = go.Figure()
data=0
X=[]
Y=[]
for trial in range(len(frames_ts)):
for data in range(len(frames_ts[trial])):
new_y=original_output[trial][data];
new_x = frames_ts[trial][data]/sampling_rate;
X.append(new_x);
Y.append(new_y);
data = data + 1;
fig.add_trace(go.Scatter(x = X, y =Y, mode='markers', name='Real'))
Upvotes: 0
Views: 53
Reputation: 31226
Scattergl()
instead of Scatter()
as trace typeimport numpy as np
import plotly.graph_objects as go
go.Figure(
go.Scattergl(
x=np.linspace(0, 100, 155585),
y=np.sin(np.linspace(0, 100, 155585)),
mode="markers",
name="Real",
)
)
Upvotes: 1