Skip to content

viz.plot_sensors() only partially honors axes parameter #7850

Description

@hoechenberger

Describe the bug

I wanted to add sensor alignment plots via Raw.plot_sensors() to some subplots of a larger figure. While the sensors are getting plotted, I observe some very annoying side effects that imho qualify as bugs.

Steps to reproduce

import matplotlib.pyplot as plt
import mne
from mne.datasets import sample

data_path = sample.data_path()
fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(fname)

fig, ax = plt.subplots(2, 2)

ax[0, 0].plot(range(10))
ax[0, 0].set_title('Title A')

ax[1, 0].plot(range(10))
ax[1, 0].set_title('Title B')

raw.plot_sensors(ch_type='mag', axes=ax[0, 1])
raw.plot_sensors(ch_type='grad', axes=ax[1, 1])

Expected results

All subplots should appear in their designated axes.

Actual results

Figure_1

  • First sensor plot doesn't have a title
  • Second sensor plot's title appears as suptitle while it should be an axes title
  • The entire figure appears to be truncated at the top, left, and bottom

Additional information

The behavior reminds me somewhat of #7595, which has been fixed by @drammock in #7706.

I'm using Matplotlibs Qt backend on macOS.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions