Skip to content

plotly on jupyter creates HUGE notebooks file sizes #5056

Closed
@urirosenberg

Description

@urirosenberg

Hi, we are seeing an issue with plotly v6.0.0 where running in jupyter creates HUGE notebook files, resulting in crashed kernel and inability to save.

Sample code to reproduce the issue (full example can be found here):

import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import numpy as np

# Create sample data
dates = pd.date_range(start='2024-01-01', end='2024-12-31', freq='M')
values = np.random.randn(12).cumsum()
categories = ['A', 'B', 'C', 'D']
values_bar = [23, 45, 56, 78]

# Line Chart
fig1 = px.line(x=dates, y=values, 
               title='Monthly Trend 2024',
               labels={'x': 'Date', 'y': 'Value'})
fig1.show()

# Scatter Plot with custom styling
fig2 = go.Figure()
fig2.add_trace(go.Scatter(
    x=np.random.randn(100),
    y=np.random.randn(100),
    mode='markers',
    marker=dict(
        size=10,
        color=np.random.randn(100),
        colorscale='Viridis',
        showscale=True
    )
))
fig2.update_layout(title='Scatter Plot with Color Scale')
fig2.show()

# Bar Chart
fig3 = px.bar(x=categories, y=values_bar,
              title='Category Distribution',
              labels={'x': 'Category', 'y': 'Value'},
              color=values_bar,
              color_continuous_scale='Reds')
fig3.show()

Using plotly version 5.24.1, this generates a >1M file.
Using plotly version 6.0.0, this generates a 19M file.

Looking at the v6.0.0 notebook source json file, I see massive amounts of JS code.

Metadata

Metadata

Assignees

Labels

P1needed for current cyclebugsomething brokenperformancesomething is slow

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions