Skip to content

Commit

Permalink
Merge pull request hyperspy#3456 from ericpre/fix_mpl3.10
Browse files Browse the repository at this point in the history
Replace iterators by list in `hs.plot.plot_spectra` which fails with matplotlib 3.10
  • Loading branch information
jlaehne authored Nov 4, 2024
2 parents 021de72 + 0be9ecb commit 462a7b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hyperspy/drawing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ def _reverse_legend(ax_, legend_loc_):
handles = line.legend_handles
else:
handles = line.legendHandles
ax_.legend(reversed(handles), reversed(labels), loc=legend_loc_)
ax_.legend(handles[::-1], labels[::-1], loc=legend_loc_)

# Before v1.3 default would read the value from prefereces.
if style == "default":
Expand Down
1 change: 1 addition & 0 deletions upcoming_changes/3456.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in :func:`~.api.plot.plot_spectra` when reversing legend handles since matplotlib expects a list and not an iterator.

0 comments on commit 462a7b2

Please sign in to comment.