Saving an interactive Matplotlib figure to HTML?

Dear plotters,

I am working on an ML project and I wrote a piece of code that does some visualization on the output of such model. The visualization uses some slider to view cross section of the data.

I use Weight and Biases to log things and I can use HTML to save interactive plots. However I have not seen any trivial way to save matplotlib plots to disk. It would be nice to save it as an HTML file, but if not I can work with some weird format to disk so I can view it later.

I tried to use conversion using plotly and mpld3, but neither conversion works nicely. I also tried to log the plt object directly to wandb, but the sliders are inactive.

Any ideas?

EDIT: I tried the pickle solution as described here python - Saving interactive Matplotlib figures - Stack Overflow but the plot immediately shuts down after I open it…

EDIT2: I also tried to make the plot natively in Plotly, but it seems more much complex to implement: