You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
init_notebook_mode(connected=False) and pio.renderers.default='notebook' should not include full plotly.js on each call, but should check if already loaded #1531
The current js generated by init_notebook_mode(connected=False) is naive: it includes a require.undef("plotly") to remove plotly and the full plotlyjs code to create it again. This adds 6MB for each call to init_notebook_mode to the notebook size. It also makes opening the notebook slower.
Now just call iplot_my_thing twice, in two different jupyter cells. Save the notebook after each call and check its size.
The code shown wraps init_notebook_mode and iplot. This is necessary so calls to iplot_my_thing work under all circumstances, including users that load a notebook without restarting the kernel and not running the cell containing init_notebook_mode.
If this js fix is implemented, plotly.offline.iplot could just call init_notebook_mode directly and init_notebook_mode would not be needed in the public plotly API which would be a better UX.