plotly_express icon indicating copy to clipboard operation
plotly_express copied to clipboard

Including scattegl plot

Open harisbal opened this issue 6 years ago • 6 comments

Hello, Do we know whether scattergl will be also included in plotly_express and if so if it in the imminent road map? Cheers

harisbal avatar May 22 '19 14:05 harisbal

For all the functions that generate trace types that support WebGL acceleration (px.scatter(), px.line(), px.scatter_polar(), px.line_polar()) you can pass a render_mode="webgl" argument to force that behaviour or render_mode="svg" to disable it. The default is "auto" which uses some heuristics to do the right thing :)

nicolaskruchten avatar May 22 '19 15:05 nicolaskruchten

I tried the suggested approach and I do not see any benefit. Do we need to install or enable something before webgl can work?

harisbal avatar May 22 '19 16:05 harisbal

OK, what kinds of "benefit" were you expecting that you didn't get? In general, scattergl is meant to look as close as possible to scatter so in principle you should see very little difference.

nicolaskruchten avatar May 22 '19 16:05 nicolaskruchten

@nicolaskruchten thank you for looking into that.

I mean performance wise. I didn't mention that I am working on a jupyter notebook which becomes quite slow and non responsive even when I try render_mode='webgl'. I tested both in Chrome and Firefox (both with latest versions)

Following the traditional approach using go.Scattergl on the exact same data, plots fast without any effects on the responsiveness of the notebook.

I checked the code and the constructor gets correctly instantiated as go.Scattergl https://github.com/plotly/plotly_express/blob/2d0482db751f1e815cc5890d7d992d60941d8e68/plotly_express/_core.py#L833-L835

so it's probably something wrong from my side..

harisbal avatar May 22 '19 17:05 harisbal

Interesting. Can you share some sample code about how you're doing it the traditional way? Are you using plotly.offline.iplot?

nicolaskruchten avatar May 22 '19 17:05 nicolaskruchten

You can test it here Cheers

harisbal avatar May 22 '19 18:05 harisbal