ica.plot_properties(show=False) still shows the plot

  • MNE version: 1.9.0
  • operating system: Ubuntu 24.04
ica = ICA(
        n_components=15,
        method='fastica',
        max_iter="auto", 
        random_state=0
        )
ica.fit(raw)
figs = ica.plot_properties(
        raw, 
        picks=list(range(ica.n_components)), 
        show=False
        )

This plots all the 15 components.
How to prevent it from plotting? I use show=False, I just want to get the figs object.

Try using plt.ioff() to turn off showing figures and then plt.ion() if you want to turn it back on.

It looks like MNE turns on interactive mode, which is why these figures appear even if show=False. In my opinion, this is an issue (or at the very least highly unexpected behavior), since Matplotlib’s default is to disable interactive mode. Do you know if (1) MNE really enables interactive plotting, (2) how to disable it (plt.ioff() does not work), and (3) if this is really an intentional “feature”?

1 Like

I don’t know :slight_smile: