Skip to content

Commit

Permalink
Try changes from #179
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Sep 16, 2024
1 parent 59a7ed5 commit 559249e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sfs/plot2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ def _register_cmap_clip(name, original_cmap, alpha):
cmap = LinearSegmentedColormap.from_list(name, cdata)
cmap.set_over([alpha * c + 1 - alpha for c in cmap(1.0)[:3]])
cmap.set_under([alpha * c + 1 - alpha for c in cmap(0.0)[:3]])
_plt.cm.register_cmap(cmap=cmap)
_plt.colormaps.register(cmap=cmap)


# The 'coolwarm' colormap is based on the paper
# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland
# http://www.sandia.gov/~kmorel/documents/ColorMaps/
_register_cmap_clip('coolwarm_clip', 'coolwarm', 0.7)
# already registered in MPL 3.9.0
try:
_register_cmap_clip('coolwarm_clip', 'coolwarm', 0.7)
except ImportError:
pass


def _register_cmap_transparent(name, color):
Expand All @@ -36,7 +40,7 @@ def _register_cmap_transparent(name, color):
'blue': ((0, blue, blue), (1, blue, blue)),
'alpha': ((0, 0, 0), (1, 1, 1))}
cmap = LinearSegmentedColormap(name, cdict)
_plt.cm.register_cmap(cmap=cmap)
_plt.colormaps.register(cmap=cmap)


_register_cmap_transparent('blacktransparent', 'black')
Expand Down

0 comments on commit 559249e

Please sign in to comment.