"The number of FixedLocator locations" error again in new MNE version

  • MNE version: e.g. 0.24.1 and 0.20.5
  • operating system: Windows 11

Relevant code snippets:

raw.plot(n_channels=8, scalings=6e1, title='Filtered EEG data (1 - 30 Hz)', show=True)
epochs.plot(scalings='auto')

I am working again on an EEG data that I worked last year. The code was okay last year with the versions I had but now it is not working anymore and gives this error:

ValueError: The number of FixedLocator locations (20), usually from a call to set_ticks, does not match the number of ticklabels (120).

I checked thread #8031 and realized it is a version inconsistency between MNE and Mathplotlib and tried upgrading and downgrading both packages to different versions. However, non of the combinations solved the issue. I tired two combinations:

  • mne (v.20.5) with mathplotlib (v.3.2.1) --this is my original code
  • mne (v.24.1) with mathplotlib (v.3.5.1) --the latest versions of both packages

But the error persist. Can anybody please help me?

I tried this with Matplotlib 3.5.1, using both MNE-Python 0.24.1 and the current development version of MNE-Python. I cannot reproduce the error. Can you offer a fully reproducible example please? Here’s what I did:

import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
                                   'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False, preload=False)
fig = raw.plot(n_channels=8, scalings=6e1, title='foo', show=True)

Thank you @drammock. You are right. I realized that the code was also using the matplotlib-inline and all I had to do was to update that package as well!
Thanks for rapid reply!