plotly-resampler icon indicating copy to clipboard operation
plotly-resampler copied to clipboard

cannot get dynamic resampling in databricks python notebook (or generated html)

Open jhgorse opened this issue 2 years ago • 2 comments

Greetings,

I am trying to generate a standalone html file, as plotly does, with the plotly-resampler such that it will dynamically resample based on zoom events. Currently, I get statically resampled windowed data that does not resample on zoom.

I have tried various combinations from the documentation, including:

  • register_plotly_resampler(mode="widget", default_n_shown_samples=1500) # auto inline_persistent inline widget
  • FigureWidgetResampler

Databricks notebook is free here: https://community.cloud.databricks.com/login.html

The only addition I made were the python libraries here with this cell: %pip install plotly_resampler lttbc

Thank you for your time.

Cheers, Joe

jhgorse avatar May 03 '23 13:05 jhgorse

Hi @jhgorse,

regarding the HTML export, I suggest you first look at our docs' FAQ and this related issue #175

I have not yet tried the DataBricks notebooks. But we already observed that plotly-resampler does not seem to work in Kaggle notebooks. This is caused by:

  1. Kaggle did not seem to support Plotly FigureWidgets at the time of the investigation. Can you make a plain plotly FigureWidget work in the Databricks notebook environment?
  2. Furthermore, the notebooks did not allow forwarding the network port that needs to be spawned for the Dash app. Are there any settings or documentation w.r.t. port forwarding for Databricks notebooks?

As a final note. Plotly-resampler leverages the Python back-end to perform aggregation based on javascript (front-end) interaction. So you always need a connected kernel to perform aggregation. The only way you would be able to create such resample visualizations in HTML without a connected Python kernel is if the unaggregated data resides within the HTML file and the aggregation would be performed in the JavaScript code. This would increase the size of HTML files significantly, making it a big hassle to share and load these files.

I hope this answers your question, Kind regards Jonas

jonasvdd avatar May 04 '23 07:05 jonasvdd

Jonas,

Thank you kindly for writing.

The FAQ question and answer content What is the difference between plotly-resampler figures and plain plotly figures? belong on the main github plotly-resampler readme. Before Features and after the intro paragraph. This is the key architectural information which communicates what plotly-resampler actually is. Thus prescribing its intended use and limitations.

I read #175. My use case is different.

We have a lot of data. Few look at it. The notebooks are all specialized with great learning curves and people are spread thin. I want to fix the viewing problem by making self-contained, browser-only dependency, html js plots with a good deal of data historical data up to the present. The target is about 50 to 100 MB of compressed data, which gets you pretty far in terms of visibility. If they want to change things, use the notebook it came from. I want data exploration to be painless click-drag, point zoom, plotly-esque. I want it to start zoomed out and allow significant zooming in to the finer granular data.

So, if possible, I want a standalone plotly-resampler.

If I must have a server involved in this, then I also want live, real-time updates (sub 5 second latency). =)

Hope this finds you well.

Cheers, Joe

jhgorse avatar May 04 '23 14:05 jhgorse