dianna-ai / dianna

Deep Insight And Neural Network Analysis
https://dianna.readthedocs.io
Apache License 2.0
44 stars 13 forks source link

enable passing of external Axes to plot on #802

Closed egpbos closed 1 week ago

egpbos commented 2 weeks ago

Adds to the plot_image and plot_tabular functions an optional argument ax: plt.Axes. When given, this is the Axes that will be used to plot on and the internal plt.subplots call is skipped. This is useful for using these functions in custom multi-panel plots (we want to use this in a paper).

We actually only need this for the plot_image function, but I added it to plot_tabular as a bonus ;) The plot_timeseries function is too complicated, I don't have time to add it there right now, but the principle will be similar (except now the ax has to be passed through three layers of helper functions).

egpbos commented 2 weeks ago

P.S.: "we" here is me and @cwmeijer :)

egpbos commented 2 weeks ago

Whoops, forgot to rebase on main, done now.

egpbos commented 2 weeks ago

Your nitpick is my command ;)

I did not hint it completely. The matplotlib stuff is just too complex and bloaty and increases maintenance cost. I think the reference in the docstring to go look at mpl.Axes.imshow is best for those options.

egpbos commented 2 weeks ago

The CI failures are HTTP timeouts unrelated to this PR.

egpbos commented 2 weeks ago

Will you merge when you think it's done?