vferat/pycrostates

[JOSS Review] Functionality

Closed this issue · 5 comments

As part of #61

When plotting the microstate topographies inline (with %matplotlib inline) using ModK.plot(), I ran into a small snag where the generated figures do not appear to have a background, which makes it difficult to read the labels of the different clusters when using a dark theme. I have attached an image of the plot generated below. However, interestingly, the figures appear normally when using matplotlib backend ‘TkAgg’ instead. To provide additional context, I’m using matplotlib version 3.5.2 with VScode (version 1.70.1). Perhaps an option to set the background colour inline could be added?

image

I am not super familiar with inline plotting and with notebooks in general. Could you also tell us which matplotlib backend you were using by default? I'll have a look.

Hi @mscheltienne, I'm using TkAgg as my default backend. The plots appear normally when I display them in a new window using %matplotlib so it appears to be a problem specific to inline plots

Ok, I'll try to play a bit with it. Thanks!

Hey @anshu-97

I worked a bit on your issue today.

It seems a bit complicated to manage all the display cases, especially light/dark mode. That's why we have chosen to return the matplotlib figures leaving the user the possibility to modify the figure as they wish using matplotlib features.

In this current issue, one solution would be to modify title colors:

fig = ModK.plot(show=False)
fig.axes[0].title.set_color('blue')

image

In order to give more control to the user on the display of the microstate topographies, we are currently adding a **kwargs parameter to ModK.plot() in #81. **kwargs are directly passed tomne.viz.plot_topomap. For exemple:

fig = ModK.plot(cmap='plasma', show=False, contours=0)

image

Let me know if you think this current solution seems suitable for your use case.

Hi @vferat,

Adding a new argument to allow more user control sounds great to me!
Thanks a lot!