Kitware / trame-plotly

trame-plotly brings Plotly charts into trame
MIT License
2 stars 0 forks source link

Dynamically theme plots using a state variable #5

Open MattTheCuber opened 1 month ago

MattTheCuber commented 1 month ago

When creating Plotly figures, you can specify the theme using the argument go.Figure(layout={"template": "plotly_dark"}). However, this is not dynamic and you must generate a new plot to update the plot's theme.

Is it be possible to specify the theme dynamically by using something like plotly.Figure(figure=fig, layout=("plotly_theme", {"template": "plotly_dark"})). This does not currently work (or even run), I tried multiple ways for dynamic theming.

jourdain commented 1 month ago

Hi Matthew,

I can probably come up with some logic to enable it. It will probably take a day of work to get things right. So far on your contract you still have ~14h available.

Do you want me to go ahead to start working on it?

Thanks,

Seb

On Thu, Oct 3, 2024 at 5:55 AM Matthew Vine @.***> wrote:

When creating Plotly figures, you can specify the theme using the argument go.Figure(layout={"template": "plotly_dark"}). However, this is not dynamic and you must generate a new plot to update the plot's theme.

Is it be possible to specify the theme dynamically by using something like plotly.Figure(figure=fig, layout=("plotly_theme", {"template": "plotly_dark"})). This does not currently work (or even run), I tried multiple ways for dynamic theming.

— Reply to this email directly, view it on GitHub https://github.com/Kitware/trame-plotly/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACH45RN6OYP3DEDDOHCBFDZZUWCRAVCNFSM6AAAAABPJUASZOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU3DGOBWGM3TSOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MattTheCuber commented 1 month ago

Oh, no that is fine. I was just expecting that we were using the incorrect arguments. We will continue updating the figures manually using .update_figure().

jourdain commented 1 month ago

Roger that. Thanks for letting me know.

On Thu, Oct 3, 2024 at 9:03 AM Matthew Vine @.***> wrote:

Oh, no that is fine. I was just expecting that we were using the incorrect arguments. We will continue updating the figures manually using .update_figure().

— Reply to this email directly, view it on GitHub https://github.com/Kitware/trame-plotly/issues/5#issuecomment-2391655112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACH45TPD3VDSTLASGUGEQTZZVMELAVCNFSM6AAAAABPJUASZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJRGY2TKMJRGI . You are receiving this because you commented.Message ID: @.***>