Skip to content

Commit

Permalink
Matplotlib 3.9 changed their API (#3572)
Browse files Browse the repository at this point in the history
  • Loading branch information
JDBetteridge authored May 16, 2024
1 parent f58f5ba commit 889252b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion firedrake/pyplot/mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ def facet_data(typ):
color_key = "colors" if tdim <= 2 else "facecolors"
boundary_colors = boundary_kw.pop(color_key, None)
if boundary_colors is None:
cmap = matplotlib.cm.get_cmap("Dark2")
# matplotlib.cm.get_cmap was deprecated in Matplotlib 3.9, see:
# https://matplotlib.org/3.9.0/api/prev_api_changes/api_changes_3.9.0.html#top-level-cmap-registration-and-access-functions-in-mpl-cm
try:
cmap = matplotlib.cm.get_cmap("Dark2")
except AttributeError:
cmap = matplotlib.colormaps["Dark2"]
num_markers = len(markers)
colors = cmap([k / num_markers for k in range(num_markers)])
else:
Expand Down

0 comments on commit 889252b

Please sign in to comment.