astoff / comint-mime

Display graphics and other MIME attachments in Emacs shells
66 stars 7 forks source link

bug: matplotlib rcParams modified if comint-mime-prefer-svg is non-nil #23

Open pank opened 1 month ago

pank commented 1 month ago

It's great that svg support has been added!

But modifying matplotlib rcParams is a bug IMHO, as it changes the current mpl style (which might have set the facecolor) and therefore (potentially) changes the style of saved figures (plt.style is used for theming and does so my changing the rcParams).

Instead, the facecolor could be set for matplotlib_inline only, e.g. (in ipython_config.py syntax):

c.InlineBackend.print_figure_kwargs.update({"facecolor": (0, 0, 0, 0),})

However, if the axes facecolor is set this creates funny results where the plotting area has one facecolor but the surrounding area is transparent (e.g. axis labels and titles). I don't know if print_figure can change axes facecolors. IMHO, even changing the matplotlib_inline figure facecolor is a bit of a can of worms... (And if opinionated settings are applied more or less silently, why not get rid of the horrible tight layout default setting at the same time ('bbox_inches': None)?)

astoff commented 8 hours ago

Sorry for the delay to respond, I hope I will have time to have a look in the coming week.