plotly / plotly_express

Plotly Express - Simple syntax for complex charts. Now integrated into plotly.py!
https://plot.ly/python/plotly-express/
MIT License
4 stars 0 forks source link

Argument for plots to become non-interactive to save memory in Jupyter #170

Closed indiana-nikel closed 3 years ago

indiana-nikel commented 3 years ago

Hello,

I was wondering if there are plans (or existing functionality!) to allow plotly.express plots to be created as a static image rather than an interactive plot?

The issue that I've been running into lately is when plotting large datasets, the interactive plots tend to eat up a chunk of memory. At a certain point of information (ie. too much data for one plot or a few larger plots), Jupyter tends to crash, forcing a restart of the kernel and the outputs. My workaround has been to down-sample what I am plotting, but that's not a wonderful solution, understanding that the limitation is with Jupyter + browser rather than with plotly.express. I love the visuals and quality-of-life of plotly.express over matplotlib and I would love a solution to be able to plot many charts with lots of data without the potential for a crash!

A potential type of implementation that would be interesting might follow this kind of convention:

import plotly.express as px

fig = px.line(
    data_frame,
    x="X_column",
    y="Y_column",
    interactive=False,
)
fig.show()

In this case, the interactive argument would change the output of the plot to either be as it is currently (interactive=True) or as a static image (interactive=False), with a similar type of output as matplotlib.

Loving the work on this library!

indiana-nikel commented 3 years ago

Opened in plotly.py instead.