Skip to content

Commit

Permalink
update deprecated cmap retrival
Browse files Browse the repository at this point in the history
  • Loading branch information
katosh committed Nov 16, 2024
1 parent 81fa893 commit 41d5fa8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/palantir/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,11 @@ def plot_stats(
}
scatter_kwargs.update(kwargs)

default_cmap = matplotlib.colormaps["viridis"]
cmap = copy(matplotlib.colormaps.get(cmap, default_cmap))
try:
cmap = matplotlib.colormaps[cmap] if isinstance(cmap, str) else cmap
except KeyError:
cmap = matplotlib.colormaps["viridis"]
cmap = copy(cmap)
cmap.set_bad(na_color)

na_color = matplotlib.colors.to_hex(na_color, keep_alpha=True)
Expand Down

0 comments on commit 41d5fa8

Please sign in to comment.