File tree 1 file changed +8
-6
lines changed 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -132,12 +132,14 @@ def plot_examples(colormaps):
132
132
plot_examples ([viridis , newcmp ])
133
133
134
134
##############################################################################
135
- # We can easily reduce the dynamic range of a colormap; here we choose the
136
- # middle 0.5 of the colormap. However, we need to interpolate from a larger
137
- # colormap, otherwise the new colormap will have repeated values.
138
-
139
- viridis_big = cm .get_cmap ('viridis' , 512 )
140
- newcmp = ListedColormap (viridis_big (np .linspace (0.25 , 0.75 , 256 )))
135
+ # We can reduce the dynamic range of a colormap; here we choose the
136
+ # middle half of the colormap. Note, however, that because viridis is a
137
+ # listed colormap, we will end up with 128 discrete values instead of the 256
138
+ # values that were in the original colormap. This method does not interpolate
139
+ # in color-space to add new colors.
140
+
141
+ viridis_big = cm .get_cmap ('viridis' )
142
+ newcmp = ListedColormap (viridis_big (np .linspace (0.25 , 0.75 , 128 )))
141
143
plot_examples ([viridis , newcmp ])
142
144
143
145
##############################################################################
You can’t perform that action at this time.
0 commit comments