When I save a Jupyter Notebook with many charts as an HTML file, the charts are rendered, but the first charts lose their data.
WARNING: Too many active WebGL contexts. Oldest context will be lost. Is there a way to resolve this?
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import plotly.express as px
# Create DF
start_date = datetime(2018, 1, 1)
end_date = datetime(2022, 12, 31)
num_days = (end_date - start_date).days + 1
num_cols = 100
data = np.random.rand(num_days, num_cols)
dates = [start_date + timedelta(days=i) for i in range(num_days)]
df = pd.DataFrame(data, columns=[f"Column_{i+1}" for i in range(num_cols)])
df['Date'] = dates
x = 10
while x < len(df.columns):
columns_to_plot = df.columns[x-10:x].tolist()
fig = px.line(df, x=df['Date'], y=columns_to_plot)
fig.show()
x += 10