Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0bac836

Browse files
jklymakgreglucas
andauthored
Apply suggestions from code review
Co-authored-by: Greg Lucas <[email protected]>
1 parent 7c48850 commit 0bac836

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tutorials/colors/colormap-manipulation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ def plot_examples(colormaps):
133133

134134
##############################################################################
135135
# 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.
139140

140-
viridis_big = cm.get_cmap('viridis', 256)
141+
viridis_big = cm.get_cmap('viridis')
141142
newcmp = ListedColormap(viridis_big(np.linspace(0.25, 0.75, 128)))
142143
plot_examples([viridis, newcmp])
143144

0 commit comments

Comments
 (0)