Skip to content

Commit e627e95

Browse files
committed
Add and use 'sequence' type specifier instead of 'list'
1 parent c20ed1d commit e627e95

File tree

12 files changed

+168
-164
lines changed

12 files changed

+168
-164
lines changed

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@
173173
'sequence': ':term:`sequence`',
174174
'iterable': ':term:`iterable`',
175175
'mapping': ':term:`mapping`',
176-
'hashable': ':term:`hashable <name>`',
176+
'hashable': ':term:`hashable`',
177+
'sequence': ':term:`sequence`',
177178
'dict-like': ':term:`dict-like <mapping>`',
178179
'path-like': ':term:`path-like <path-like object>`',
179180
'file-like': ':term:`file-like <file-like object>`',
@@ -192,6 +193,7 @@
192193
'norm-spec': ':py:func:`norm-spec <proplot.constructor.Norm>`',
193194
'color-spec': ':py:func:`color-spec <matplotlib.colors.is_color_like>`',
194195
'channel-spec': ':py:func:`color-spec <matplotlib.colors.is_color_like>`',
196+
'artist': ':py:func:`artist <matplotlib.artist.Artist>`',
195197
}
196198

197199
# Fix duplicate class member documentation from autosummary + numpydoc

docs/projections.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# ---------------
3939
#
4040
# To create geographic axes, pass e.g. ``proj='name'`` to an axes-creation
41-
# command where ``name`` is any valid :ref:`PROJ projection name <proj_included>`.
41+
# command where ``name`` is any valid :ref:`PROJ projection name <proj_table>`.
4242
# Alternatively, you can use ``proj=projection_instance`` where ``projection_instance``
4343
# is a `cartopy.crs.Projection` or `~mpl_toolkits.basemap.Basemap` instance returned
4444
# by the `~proplot.constructor.Proj` :ref:`constructor function <why_constructor>`
@@ -378,8 +378,8 @@
378378
#
379379
# The available `cartopy <https://scitools.org.uk/cartopy/docs/latest/>`__
380380
# and `basemap <https://matplotlib.org/basemap/index.html>`__ projections are
381-
# plotted below. See `~proplot.constructor.Proj` for a table of projection
382-
# names with links to the relevant `PROJ <https://proj.org>`__ documentation.
381+
# plotted below. The full table of projection names with links to the relevant
382+
# `PROJ <https://proj.org>`__ documentation is found :ref:`here <proj_table>`.
383383
#
384384
# ProPlot uses the cartopy API to add the Aitoff, Hammer, Winkel Tripel, and
385385
# Kavrisky VII projections (i.e., ``'aitoff'``, ``'hammer'``, ``'wintri'``,

proplot/axes/base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
rowlabels, collabels, llabels, tlabels, rlabels, blabels
266266
Aliases for `leftlabels` and `toplabels`, and for `leftlabels`,
267267
`toplabels`, `rightlabels`, and `bottomlabels`, respectively.
268-
leftlabels, toplabels, rightlabels, bottomlabels : list of str, optional
268+
leftlabels, toplabels, rightlabels, bottomlabels : sequence of str, optional
269269
Labels for the subplots lying along the left, top, right, and
270270
bottom edges of the figure. The length of each list must match
271271
the number of subplots along the corresponding edge.
@@ -310,20 +310,20 @@
310310

311311
# Colorbar docstrings
312312
_colorbar_args_docstring = """
313-
mappable : mappable, list of artists, list of color-spec, or colormap-spec
313+
mappable : mappable, sequence of artist, sequence of color-spec, or colormap-spec
314314
There are four options here:
315315
316316
1. A mappable object. Basically, any object with a ``get_cmap`` method,
317317
like the objects returned by `~matplotlib.axes.Axes.contourf` and
318318
`~matplotlib.axes.Axes.pcolormesh`.
319-
2. A list of matplotlib artists. Any object with a ``get_color`` method
319+
2. A sequence of matplotlib artists. Any object with a ``get_color`` method
320320
will do, like `~matplotlib.lines.Line2D` instances. A colormap will
321321
be generated from the colors of these objects, and colorbar levels
322322
will be selected using `values`. If `values` is ``None``, we try
323323
to infer them by converting the handle labels returned by
324324
`~matplotlib.artist.Artist.get_label` to `float`. Otherwise, it is
325325
set to ``np.linspace(0, 1, len(mappable))``.
326-
3. A list of hex strings, color string names, or RGB tuples. A colormap
326+
3. A sequence of hex strings, color string names, or RGB tuples. A colormap
327327
will be generated from these colors, and colorbar levels will be
328328
selected using `values`. If `values` is ``None``, it is set to
329329
``np.linspace(0, 1, len(mappable))``.
@@ -332,7 +332,7 @@
332332
`values`. If `values` is ``None``, it is set to
333333
``np.linspace(0, 1, cmap.N)``.
334334
335-
values : list of float or str, optional
335+
values : sequence of float or str, optional
336336
Ignored if `mappable` is a mappable object. This maps each color or
337337
plot handle in the `mappable` list to numeric values, from which a
338338
colormap and normalizer are constructed. These can also be strings,
@@ -423,12 +423,12 @@
423423

424424
# Legend docstrings
425425
_legend_args_docstring = """
426-
handles : list of `~matplotlib.artist.Artist`, optional
426+
handles : list of artist, optional
427427
List of matplotlib artists, or a list of lists of artist instances (see
428428
the `center` keyword). If ``None``, artists with valid labels are retrieved
429429
automatically. If the object is a `~matplotlib.contour.ContourSet`, the
430430
``legend_elements`` method is used to pair the collection or contour set label
431-
with the central element in the list (generally giving the central colormap
431+
with the central artist in the list (generally giving the central colormap
432432
color if the object is controlled with a colormap).
433433
labels : list of str, optional
434434
A matching list of string labels or ``None`` placeholders, or a matching list of
@@ -3008,7 +3008,7 @@ def _iter_axes(self, hidden=False, children=False, panels=True):
30083008
Whether to include "hidden" panels.
30093009
children : bool, optional
30103010
Whether to include children. Note this now includes "twin" axes.
3011-
panels : bool or str or list of str, optional
3011+
panels : bool or str or sequence of str, optional
30123012
Whether to include panels or the panels to include.
30133013
"""
30143014
# Parse panels

proplot/axes/plot.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,14 @@
337337
_manual_levels_docstring = """
338338
N
339339
Shorthand for `levels`.
340-
levels : int or list of float, optional
341-
The number of level edges or a list of level edges. If the former,
340+
levels : int or sequence of float, optional
341+
The number of level edges or a sequence of level edges. If the former,
342342
`locator` is used to generate this many level edges at "nice" intervals.
343343
If the latter, the levels should be monotonically increasing or
344344
decreasing (note that decreasing levels will only work with ``pcolor``
345345
plots, not ``contour`` plots). Default is :rc:`cmap.levels`.
346-
values : int or list of float, optional
347-
The number of level centers or a list of level centers. If the former,
346+
values : int or sequence of float, optional
347+
The number of level centers or a sequence of level centers. If the former,
348348
`locator` is used to generate this many level centers at "nice" intervals.
349349
If the latter, levels are inferred using `~proplot.utils.edges`.
350350
This will override any `levels` input.
@@ -391,7 +391,7 @@
391391
label, value : float or str, optional
392392
The single legend label or colorbar coordinate to be used for this plotted
393393
element. This is generally used with 1D input coordinates.
394-
labels, values : list of float or list of str, optional
394+
labels, values : sequence of float or sequence of str, optional
395395
The legend labels or colorbar coordinates used for each plotted element.
396396
Can be numeric or string, and must match the number of plotted elements.
397397
This is generally used with 2D input coordinates.
@@ -522,11 +522,11 @@
522522
negcolor, poscolor : color-spec, optional
523523
Colors to use for the negative and positive lines. Ignored if `negpos`
524524
is ``False``. Defaults are :rc:`negcolor` and :rc:`poscolor`.
525-
c, color, colors : color-spec or list, optional
525+
c, color, colors : color-spec or sequence, optional
526526
The line color(s).
527-
ls, linestyle, linestyles : str or list, optional
527+
ls, linestyle, linestyles : str or sequence, optional
528528
The line style(s).
529-
lw, linewidth, linewidths : float or list, optional
529+
lw, linewidth, linewidths : float or sequence, optional
530530
The line width(s).
531531
%(plot.cycle)s
532532
%(plot.labels_1d)s
@@ -602,7 +602,7 @@
602602
Parameters
603603
----------
604604
%(plot.args_1d_{y})s
605-
s, size, ms, markersize : float or list of float, optional
605+
s, size, ms, markersize : float or sequence of float, optional
606606
The marker size(s). If this is an array matching the shape of `x` and `y`,
607607
the units are scaled by `smin` and `smax`.
608608
c, color, colors, mc, markercolor, markercolors \
@@ -618,10 +618,10 @@
618618
Other parameters
619619
----------------
620620
lw, linewidth, linewidths, markeredgewidth, markeredgewidths \
621-
: float or list, optional
621+
: float or sequence, optional
622622
The marker edge width.
623623
edgecolors, markeredgecolor, markeredgecolors \
624-
: color-spec or list, optional
624+
: color-spec or sequence, optional
625625
The marker edge color.
626626
%(plot.cmap_norm)s
627627
%(plot.levels_manual)s
@@ -768,8 +768,8 @@
768768
Parameters
769769
----------
770770
%(plot.args_1d_{y})s
771-
bins : int or list of float, optional
772-
The bin count or list of bins.
771+
bins : int or sequence of float, optional
772+
The bin count or sequence of bins.
773773
%(plot.weights)s
774774
%(plot.args_1d_shared)s
775775
@@ -811,16 +811,16 @@
811811
`~matplotlib.axes.Axes.boxplot`.
812812
fill : bool, optional
813813
Whether to fill the box with a color.
814-
fc, facecolor, fillcolor : color-spec, list, optional
814+
fc, facecolor, fillcolor : color-spec or sequence, optional
815815
The fill color for the boxes. Default is the next color cycler color. If
816-
a list, it should be the same length as the number of objects.
816+
a sequence, it should be the same length as the number of objects.
817817
a, alpha, fa, facealpha, fillalpha : float, optional
818-
The opacity of the boxes. Default is ``1.0``. If a list,
819-
should be the same length as the number of objects.
818+
The opacity of the boxes. Default is ``1.0``. If a sequence, should
819+
be the same length as the number of objects.
820820
lw, linewidth, linewidths : float, optional
821821
The linewidth of all objects. Default is :rc:`patch.linewidth`.
822-
c, color, colors, ec, edgecolor, edgecolors : color-spec, list, optional
823-
The color of all objects. Default is ``'black'``. If a list, it should
822+
c, color, colors, ec, edgecolor, edgecolors : color-spec or sequence, optional
823+
The color of all objects. Default is ``'black'``. If a sequence, should
824824
be the same length as the number of objects.
825825
meanls, medianls, meanlinestyle, medianlinestyle, meanlinestyles, medianlinestyles \
826826
: line style-spec, optional
@@ -829,8 +829,8 @@
829829
boxc, capc, whiskerc, flierc, meanc, medianc, \
830830
boxcolor, capcolor, whiskercolor, fliercolor, meancolor, mediancolor \
831831
boxcolors, capcolors, whiskercolors, fliercolors, meancolors, mediancolors \
832-
: color-spec, list, optional
833-
The color of various boxplot components. If a list, it should be the
832+
: color-spec or sequence, optional
833+
The color of various boxplot components. If a sequence, should be the
834834
same length as the number of objects. These are shorthands so you don't
835835
have to pass e.g. a ``boxprops`` dictionary.
836836
boxlw, caplw, whiskerlw, flierlw, meanlw, medianlw, boxlinewidth, caplinewidth, \
@@ -877,17 +877,17 @@
877877
878878
Other parameters
879879
----------------
880-
fc, facecolor, facecolors, fillcolor, fillcolors : color-spec, list, optional
880+
fc, facecolor, facecolors, fillcolor, fillcolors : color-spec or sequence, optional
881881
The violin plot fill color. Default is the next color cycler color. If
882-
a list, it should be the same length as the number of objects.
883-
a, alpha, fa, facealpha, fillalpha : float, optional
884-
The opacity of the violins. Default is ``1.0``. If a list,
885-
it should be the same length as the number of objects.
882+
a sequence, should be the same length as the number of objects.
883+
c, color, colors, ec, edgecolor, edgecolors : color-spec or sequence, optional
884+
The edge color for the violin patches. Default is ``'black'``. If a
885+
sequence, should be the same length as the number of objects.
886+
a, alpha, fa, facealpha, fillalpha : float or sequence, optional
887+
The opacity of the violins. Default is ``1.0``. If a sequence,
888+
should be the same length as the number of objects.
886889
lw, linewidth, linewidths : float, optional
887890
The linewidth of the line objects. Default is :rc:`patch.linewidth`.
888-
c, color, colors, ec, edgecolor, edgecolors : color-spec, list, optional
889-
The edge color for the violin patches. Default is ``'black'``. If a
890-
list, it should be the same length as the number of objects.
891891
%(plot.cycle)s
892892
%(plot.labels_1d)s
893893
%(plot.error_bars)s
@@ -2571,9 +2571,9 @@ def _parse_levels(
25712571
The sample data. Passed to `_parse_vlim`.
25722572
N
25732573
Shorthand for `levels`.
2574-
levels : int or list of float, optional
2574+
levels : int or sequence of float, optional
25752575
The levels list or (approximate) number of levels to create.
2576-
values : int or list of float, optional
2576+
values : int or sequence of float, optional
25772577
The level center list or (approximate) number of level centers to create.
25782578
minlength : int, optional
25792579
The minimum number of levels allowed.
@@ -2694,7 +2694,7 @@ def _parse_discrete(
26942694
26952695
Parameters
26962696
----------
2697-
levels : list of float
2697+
levels : sequence of float
26982698
The level boundaries.
26992699
norm : `~matplotlib.colors.Normalize`
27002700
The continuous normalizer.
@@ -4213,8 +4213,8 @@ def hist2d(self, x, y, bins, **kwargs):
42134213
Parameters
42144214
----------
42154215
%(plot.args_1d_y)s
4216-
bins : int or 2-tuple of int, or array or 2-tuple of array, optional
4217-
The bin count or list of bins for each dimension or both dimensions.
4216+
bins : int or 2-tuple of int, or array-like or 2-tuple of array-like, optional
4217+
The bin count or sequence of bins for each dimension or both dimensions.
42184218
%(plot.weights)s
42194219
%(plot.args_1d_shared)s
42204220

0 commit comments

Comments
 (0)