48
48
# ListedColormap
49
49
# --------------
50
50
#
51
- # `.ListedColormap` s store their color values in a ``.colors`` attribute.
51
+ # `.ListedColormap`\ s store their color values in a ``.colors`` attribute.
52
52
# The list of colors that comprise the colormap can be directly accessed using
53
53
# the ``colors`` property,
54
54
# or it can be accessed indirectly by calling ``viridis`` with an array
68
68
##############################################################################
69
69
# LinearSegmentedColormap
70
70
# -----------------------
71
- # `.LinearSegmentedColormap` s do not have a ``.colors`` attribute.
71
+ # `.LinearSegmentedColormap`\ s do not have a ``.colors`` attribute.
72
72
# However, one may still call the colormap with an integer array, or with a
73
73
# float array between 0 and 1.
74
74
@@ -114,7 +114,7 @@ def plot_examples(colormaps):
114
114
115
115
##############################################################################
116
116
# In fact, that list may contain any valid
117
- # :doc:`matplotlib color specification </tutorials/colors/colors>`.
117
+ # :doc:`Matplotlib color specification </tutorials/colors/colors>`.
118
118
# Particularly useful for creating custom colormaps are Nx4 numpy arrays.
119
119
# Because with the variety of numpy operations that we can do on a such an
120
120
# array, carpentry of new colormaps from existing colormaps become quite
@@ -168,7 +168,7 @@ def plot_examples(colormaps):
168
168
# Creating linear segmented colormaps
169
169
# ===================================
170
170
#
171
- # `.LinearSegmentedColormap` class specifies colormaps using anchor points
171
+ # The `.LinearSegmentedColormap` class specifies colormaps using anchor points
172
172
# between which RGB(A) values are interpolated.
173
173
#
174
174
# The format to specify these colormaps allows discontinuities at the anchor
@@ -177,7 +177,7 @@ def plot_examples(colormaps):
177
177
# ``yleft[i]`` and ``yright[i]`` are the values of the color on either
178
178
# side of the anchor point.
179
179
#
180
- # If there are no discontinuities, then ``yleft[i]= yright[i]``:
180
+ # If there are no discontinuities, then ``yleft[i] == yright[i]``:
181
181
182
182
cdict = {'red' : [[0.0 , 0.0 , 0.0 ],
183
183
[0.5 , 1.0 , 1.0 ],
@@ -221,9 +221,10 @@ def plot_linearmap(cdict):
221
221
#
222
222
# In the example below there is a discontinuity in red at 0.5. The
223
223
# interpolation between 0 and 0.5 goes from 0.3 to 1, and between 0.5 and 1
224
- # it goes from 0.9 to 1. Note that red[0, 1], and red[2, 2] are both
225
- # superfluous to the interpolation because red[0, 1] is the value to the
226
- # left of 0, and red[2, 2] is the value to the right of 1.0.
224
+ # it goes from 0.9 to 1. Note that ``red[0, 1]``, and ``red[2, 2]`` are both
225
+ # superfluous to the interpolation because ``red[0, 1]`` (i.e., ``yleft[0]``)
226
+ # is the value to the left of 0, and ``red[2, 2]`` (i.e., ``yright[2]``) is the
227
+ # value to the right of 1, which are outside the color mapping domain.
227
228
228
229
cdict ['red' ] = [[0.0 , 0.0 , 0.3 ],
229
230
[0.5 , 1.0 , 0.9 ],
@@ -234,7 +235,7 @@ def plot_linearmap(cdict):
234
235
# Directly creating a segmented colormap from a list
235
236
# --------------------------------------------------
236
237
#
237
- # The above described is a very versatile approach , but admittedly a bit
238
+ # The approach described above is very versatile, but admittedly a bit
238
239
# cumbersome to implement. For some basic cases, the use of
239
240
# `.LinearSegmentedColormap.from_list` may be easier. This creates a segmented
240
241
# colormap with equal spacings from a supplied list of colors.
@@ -243,8 +244,8 @@ def plot_linearmap(cdict):
243
244
cmap1 = LinearSegmentedColormap .from_list ("mycmap" , colors )
244
245
245
246
#############################################################################
246
- # If desired, the nodes of the colormap can be given as numbers
247
- # between 0 and 1. E.g. one could have the reddish part take more space in the
247
+ # If desired, the nodes of the colormap can be given as numbers between 0 and
248
+ # 1. For example, one could have the reddish part take more space in the
248
249
# colormap.
249
250
250
251
nodes = [0.0 , 0.4 , 0.8 , 1.0 ]
0 commit comments