plotly-resampler: FigureWidget(Resampler) does not integrate well in google colab
In google colab plotly FigureWidget
& plotly-resampler FigureWidgetResampler
:
π work perfectly when creating an empty figure and displaying it while adding traces in another cell
Example with plotly FigureWidget
:
Example with plotly-resampler FigureWidgetResampler
:
πΏ do not work when creating the figure and adding the data + displaying it in the same cell
Example for plotly FigureWidget
& plotly-resampler FigureWidgetResampler
-> This relates to this issue; https://github.com/googlecolab/colabtools/issues/2871
(however for FigureWidgetResampler
it does not work for integer datatypes, whereas for FigureWidget
this does work)
What is the impact of this problem?
Registing plotly-resampler in google colab will result in figures that are not displayed;
FYi: to use plotly FigureWidgets in google colab you should first execute the following code (see __init__.py
);
from google.colab import output
output.enable_custom_widget_manager()
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16 (6 by maintainers)
Hey @LeonieFreisinger,
Thanks for sharing the notebook & the detailed explanation! I was able to reproduce your issue.
I (quickly) succeeded to get a functional interactive plot by using the
FigureResampler
(which uses a Dash application instead of an IPythonFigureWidget
to provide the resampling) instead of theFigureWidgetResampler
. However, note that the rendering of the plot takes some additional time (as Google has to sort out the portforwarding of the underlying (Jupyter)Dash app) - locally (or on your own server) the plot should be rendered nearly instantaneous.You can use the
FigureResampler
decorator (under the hood) through callingregister_plotly_resampler
with the βfigureβ mode.See working example below β¬οΈ
Iβll share my further findings in this Issue (Iβll investigate
FigureWidgetResampler
now).Cheers, Jeroen
@jvdd Thanks for your fast answer. I will have a more detailed look into it and get back to you asap.
@jvdd @jonasvdd Thanks for the quick feedback! I will have a look at it and get back to you shortly.
I further looked into using
FigureWidget
/FigureWidgetResampler
in Google Colab - and circled back to the issue above (for which I created this issue on the Google Colab GitHub repo https://github.com/googlecolab/colabtools/issues/2871)I donβt think the issue above will get fixed any time soon. It has been open for quite some time (7 months). Thus using
FigureWidget
/FigureWidgetResampler
in Google Colab will keep resulting in problems πBasically I see two options here;
FigureResampler
: you will have all the interactivity (i.e., resampling), but will suffer from a longer loading time. Note that the output will get cleared from the notebook (as the Dash app stops, unless you useinline_persistent
).FigureWidgetResampler
and call.show()
: this will return a static figure on which the dynamic resampling cannot be performed (when zooming). However this figure will persist in the cells output.On another note, are you intending to integrate plotly-resampler in an existing toolkit / code base? If so, @jonasvdd & me will gladly assist / give feedback w.r.t. this π
@jvdd @jonasvdd Thanks a lot for the fast answer. In general I think the functionality provided by the plotly-resampler is great. However, I face issues with getting to work in colab.
Feel free to execute this notebook in colab: https://github.com/ourownstory/neural_prophet/blob/main/tutorials/feature-use/autoregression_yosemite_temps.ipynb
Instructions:
What you will see is that the figure is not displayed. Important note: This happens only when using the custom wrapper function
m.plot()
. However, wenn plotting a dataframe with the standard.plot()
function and plotly backend, then the figure will be displayed. E.g.:One assumption for the reason of the problem is that there could be a dependencie/ package mismatch. Thanks a lot for having a look at it.