Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 79e317d commit 14d6dacCopy full SHA for 14d6dac
sfs/plot2d.py
@@ -13,8 +13,11 @@
13
def _register_cmap_clip(name, original_cmap, alpha):
14
"""Create a color map with "over" and "under" values."""
15
from matplotlib.colors import LinearSegmentedColormap
16
- cdict = plt.cm.datad[original_cmap]
17
- cmap = LinearSegmentedColormap(name, cdict)
+ cdata = plt.cm.datad[original_cmap]
+ if isinstance(cdata, dict):
18
+ cmap = LinearSegmentedColormap(name, cdata)
19
+ else:
20
+ cmap = LinearSegmentedColormap.from_list(name, cdata)
21
cmap.set_over([alpha * c + 1 - alpha for c in cmap(1.0)[:3]])
22
cmap.set_under([alpha * c + 1 - alpha for c in cmap(0.0)[:3]])
23
plt.cm.register_cmap(cmap=cmap)
0 commit comments