7272"""
7373_docstring_to_rgb = """
7474color : color-spec
75- The color. Can be a tuple of channel values, a hex string, a
76- registered color name, a cycle color like ``'C0'``, or a colormap
77- color specification (see `~proplot.colors.ColorDatabase`).
78-
79- If `space` is ``'rgb'``, this is a tuple of RGB values, and if any
80- channels are larger than ``2``, the channels are assumed to be on
81- the ``0`` to ``255`` scale and are divided by ``255``.
75+ The color. Can be a 3-tuple or 4-tuple of channel values, a hex
76+ string, a registered color name, a cycle color like ``'C0'``, or
77+ a 2-tuple colormap coordinate specification like ``('magma', 0.5)``
78+ (see `~proplot.colors.ColorDatabase` for details).
79+
80+ If `space` is ``'rgb'``, this is a tuple of RGB values, and any
81+ channels are larger than ``2``, the channels are assumed to be
82+ on the ``0`` to ``255`` scale and are divided by ``255``.
8283space : {'rgb', 'hsv', 'hcl', 'hpl', 'hsl'}, optional
8384 The colorspace for the input channel values. Ignored unless `color` is
8485 a tuple of numbers.
105106docstring ._snippet_manager ['utils.to' ] = _docstring_to_rgb
106107
107108
108- def _preserve_units (func ):
109+ def _keep_units (func ):
109110 """
110111 Very simple decorator to strip and re-apply the same units.
111112 """
@@ -123,15 +124,33 @@ def _with_stripped_units(data, *args, **kwargs):
123124
124125def arange (min_ , * args ):
125126 """
126- Identical to `numpy.arange` but with inclusive endpoints. For
127- example, ``pplt.arange(2, 4)`` returns ``np.array([2, 3, 4])`` instead
128- of ``np.array([2, 3])``. This command is useful for generating lists of
129- tick locations or colorbar level boundaries.
127+ Identical to `numpy.arange` but with inclusive endpoints. For example,
128+ ``pplt.arange(2, 4)`` returns the numpy array ``[2, 3, 4]`` instead of
129+ ``[2, 3]``. This is useful for generating lists of tick locations or
130+ colormap levels, e.g. ``ax.format(xlocator=pplt.arange(0, 10))``
131+ or ``ax.pcolor(levels=pplt.arange(0, 10))``.
132+
133+ Parameters
134+ ----------
135+ *args : float
136+ If three arguments are passed, these are the minimum, maximum, and step
137+ size. If fewer than three arguments are passed, the step size is ``1``.
138+ If one argument is passed, this is the maximum, and the minimum is ``0``.
139+
140+ Returns
141+ -------
142+ numpy.ndarray
143+ Array of points.
130144
131145 See also
132146 --------
133- proplot.axes.CartesianAxes.format
147+ numpy.arange
134148 proplot.constructor.Locator
149+ proplot.axes.CartesianAxes.format
150+ proplot.axes.PolarAxes.format
151+ proplot.axes.GeoAxes.format
152+ proplot.axes.Axes.colorbar
153+ proplot.axes.PlotAxes
135154 """
136155 # Optional arguments just like np.arange
137156 if len (args ) == 0 :
@@ -159,33 +178,32 @@ def arange(min_, *args):
159178 return np .arange (min_ , max_ , step )
160179
161180
162- @_preserve_units
181+ @_keep_units
163182def edges (z , axis = - 1 ):
164183 """
165- Calculate the approximate "edge" values along an axis given "center" values.
166- This is used internally to calculate graticule edges when you supply centers
167- to `~matplotlib.axes.Axes.pcolor` or `~matplotlib.axes.Axes.pcolormesh`. It
168- is also used to calculate colormap level boundaries when you supply centers
169- to plotting methods wrapped by `~proplot.axes.apply_cmap`.
184+ Calculate the approximate "edge" values along an axis given "center" values. The
185+ size of the axis is increased by one. This is used internally to calculate graticule
186+ edges when you supply centers to pseudocolor commands.
170187
171188 Parameters
172189 ----------
173190 z : array-like
174191 An array of any shape.
175192 axis : int, optional
176- The axis along which "edges" are calculated. The size of this axis
177- will be increased by one.
193+ The axis along which "edges" are calculated. The size of this
194+ axis will be increased by one.
178195
179196 Returns
180197 -------
181- `~ numpy.ndarray`
198+ numpy.ndarray
182199 Array of "edge" coordinates.
183200
184201 See also
185202 --------
186203 edges2d
187204 proplot.axes.PlotAxes.pcolor
188205 proplot.axes.PlotAxes.pcolormesh
206+ proplot.axes.PlotAxes.pcolorfast
189207 """
190208 z = np .asarray (z )
191209 z = np .swapaxes (z , axis , - 1 )
@@ -202,13 +220,13 @@ def edges(z, axis=-1):
202220 return np .swapaxes (zb , axis , - 1 )
203221
204222
205- @_preserve_units
223+ @_keep_units
206224def edges2d (z ):
207225 """
208226 Calculate the approximate "edge" values given a 2D grid of "center"
209- values. The size of both axes are increased by one. This is used
210- internally to calculate graticule edges when you supply centers to
211- `~matplotlib.axes.Axes.pcolor` or `~matplotlib.axes.Axes.pcolormesh` .
227+ values. The size of both axes is increased by one. This is used
228+ internally to calculate graticule edges when you supply centers
229+ to pseudocolor plot commands .
212230
213231 Parameters
214232 ----------
@@ -217,14 +235,15 @@ def edges2d(z):
217235
218236 Returns
219237 -------
220- `~ numpy.ndarray`
238+ numpy.ndarray
221239 Array of "edge" coordinates.
222240
223241 See also
224242 --------
225243 edges
226244 proplot.axes.PlotAxes.pcolor
227245 proplot.axes.PlotAxes.pcolormesh
246+ proplot.axes.PlotAxes.pcolorfast
228247 """
229248 z = np .asarray (z )
230249 if z .ndim != 2 :
0 commit comments