File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -132,12 +132,13 @@ 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.
135
+ # We can reduce the dynamic range of a colormap; here we choose the
136
+ # middle 0.5 of the colormap. Note, however, that because viridis is a
137
+ # listed colormap, some colors will be repeated when doing the nearest-neighbour
138
+ # interpolation
138
139
139
- viridis_big = cm .get_cmap ('viridis' , 512 )
140
- newcmp = ListedColormap (viridis_big (np .linspace (0.25 , 0.75 , 256 )))
140
+ viridis_big = cm .get_cmap ('viridis' , 256 )
141
+ newcmp = ListedColormap (viridis_big (np .linspace (0.25 , 0.75 , 128 )))
141
142
plot_examples ([viridis , newcmp ])
142
143
143
144
##############################################################################
You can’t perform that action at this time.
0 commit comments