File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -133,11 +133,12 @@ def plot_examples(colormaps):
133
133
134
134
##############################################################################
135
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
138
- # nearest-neighbour interpolation.
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 values
138
+ # that were in the original colormap. This method does not interpolate in color-space
139
+ # to add new colors.
139
140
140
- viridis_big = cm .get_cmap ('viridis' , 256 )
141
+ viridis_big = cm .get_cmap ('viridis' )
141
142
newcmp = ListedColormap (viridis_big (np .linspace (0.25 , 0.75 , 128 )))
142
143
plot_examples ([viridis , newcmp ])
143
144
You can’t perform that action at this time.
0 commit comments