Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/devel/13019.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``fig.mne`` container for :class:`Colorbar <matplotlib.colorbar.Colorbar>` in :func:`plot_connectivity_circle <mne_connectivity.viz.plot_connectivity_circle>` to allow users to access it directly, by `Santeri Ruuskanen`_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI for future reference I think this would have been equivalent and shorter!

Suggested change
Add ``fig.mne`` container for :class:`Colorbar <matplotlib.colorbar.Colorbar>` in :func:`plot_connectivity_circle <mne_connectivity.viz.plot_connectivity_circle>` to allow users to access it directly, by `Santeri Ruuskanen`_.
Add ``fig.mne`` container for :class:`~matplotlib.colorbar.Colorbar` in :func:`plot_connectivity_circle <mne_connectivity.viz.plot_connectivity_circle>` to allow users to access it directly, by `Santeri Ruuskanen`_.

2 changes: 2 additions & 0 deletions mne/viz/circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from functools import partial
from itertools import cycle
from types import SimpleNamespace

import numpy as np

Expand Down Expand Up @@ -371,6 +372,7 @@ def _plot_connectivity_circle(
cb_yticks = plt.getp(cb.ax.axes, "yticklabels")
cb.ax.tick_params(labelsize=fontsize_colorbar)
plt.setp(cb_yticks, color=textcolor)
fig.mne = SimpleNamespace(colorbar=cb)

# Add callback for interaction
if interactive:
Expand Down
3 changes: 3 additions & 0 deletions mne/viz/tests/test_circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def test_plot_channel_labels_circle():
fig, axes = plot_channel_labels_circle(
dict(brain=["big", "great", "smart"]),
colors=dict(big="r", great="y", smart="b"),
colorbar=True,
)
# check that colorbar handle is returned
assert isinstance(fig.mne.colorbar, matplotlib.colorbar.Colorbar)
texts = [
child.get_text()
for child in axes.get_children()
Expand Down
Loading