Open Secret-Ambush opened 3 months ago
Thanks for the report -- this is a particularly tricky one.
In your example, fig1
is a go.Figure()
. Since @render_widget
is expecting an object that inherits from ipywidgets.Widget
, it'll actually implicitly transform that go.Figure()
into a go.FigureWidget()
. And, if you try a minimal go.FigureWidget()
in a Jupyter notebook with frames
, you get:
ValueError:
Frames are not supported by the plotly.graph_objs.FigureWidget class.
Note: Frames are supported by the plotly.graph_objs.Figure class
That said, if you just want the plot to render as it does in the notebook (i.e., without transforming Figure
to FigureWidget
), you can do that by changing two lines: (1) @render_widget
-> @render.ui
and (2) return fig1
-> return ui.HTML(fig1.to_html())
.
Unfortunately, this is mainly a limitation of FigureWidget
, but I will transfer this issue over {shinywidgets}
since it should probably be throwing that same ValueError
instead of silently dropping frames
Thanks a lot, @cpsievert!
Rendering inside a HTML tag works perfectly, and I'm now able to understood why it's not working when using @render_widget
Kind Regards
I was trying to generate an animated 3D scatter plot using plotly and display it on a dashboard I created using PyShiny Express. When checking the code for an animated plotly graph on a jupyter notebook - it works perfectly, but I am not able to get the animation running on Shiny.
The graph is interactive - that is the tool tip shows the data but there's no animation when clicking on Play.
Above is a minimal reproducible code for the function to render a plot. I was thinking if the animation rendering issue has something to do with async functions so I changed this to sync. I'm not sure what to do.
My animation just affects the size of the markers in the scatter plot.
Could someone help me out?