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

Skip to content

Commit f007886

Browse files
authored
Merge pull request #27557 from timhoffm/color-type
Use :mpltype:`color` for color types
2 parents df968b5 + ab8e590 commit f007886

25 files changed

+93
-94
lines changed

doc/sphinxext/custom_roles.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ def mpltype_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
7272
if mpltype not in type_to_link_target:
7373
raise ValueError(f"Unknown mpltype: {mpltype!r}")
7474

75-
ref_nodes, messages = inliner.interpreted(
75+
node_list, messages = inliner.interpreted(
7676
mpltype, f'{mpltype} <{type_to_link_target[mpltype]}>', 'ref', lineno)
77-
node_list = [ref_nodes]
7877
return node_list, messages
7978

8079

lib/matplotlib/axes/_axes.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ def indicate_inset(self, bounds, inset_ax=None, *, transform=None,
427427
`ax.transAxes`, i.e. the units of *rect* are in Axes-relative
428428
coordinates.
429429
430-
facecolor : color, default: 'none'
430+
facecolor : :mpltype:`color`, default: 'none'
431431
Facecolor of the rectangle.
432432
433-
edgecolor : color, default: '0.5'
433+
edgecolor : :mpltype:`color`, default: '0.5'
434434
Color of the rectangle and color of the connecting lines.
435435
436436
alpha : float, default: 0.5
@@ -1097,7 +1097,7 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
10971097
Respective beginning and end of each line. If scalars are
10981098
provided, all lines will have the same length.
10991099
1100-
colors : color or list of colors, default: :rc:`lines.color`
1100+
colors : :mpltype:`color` or list of color , default: :rc:`lines.color`
11011101
11021102
linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, default: 'solid'
11031103
@@ -1188,7 +1188,7 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
11881188
Respective beginning and end of each line. If scalars are
11891189
provided, all lines will have the same length.
11901190
1191-
colors : color or list of colors, default: :rc:`lines.color`
1191+
colors : :mpltype:`color` or list of color, default: :rc:`lines.color`
11921192
11931193
linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, default: 'solid'
11941194
@@ -1324,7 +1324,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
13241324
If *positions* is 2D, this can be a sequence with length matching
13251325
the length of *positions*.
13261326
1327-
colors : color or list of colors, default: :rc:`lines.color`
1327+
colors : :mpltype:`color` or list of color, default: :rc:`lines.color`
13281328
The color(s) of the event lines.
13291329
13301330
If *positions* is 2D, this can be a sequence with length matching
@@ -2357,10 +2357,10 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23572357
23582358
Other Parameters
23592359
----------------
2360-
color : color or list of color, optional
2360+
color : :mpltype:`color` or list of :mpltype:`color`, optional
23612361
The colors of the bar faces.
23622362
2363-
edgecolor : color or list of color, optional
2363+
edgecolor : :mpltype:`color` or list of :mpltype:`color`, optional
23642364
The colors of the bar edges.
23652365
23662366
linewidth : float or array-like, optional
@@ -2392,7 +2392,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23922392
See :doc:`/gallery/statistics/errorbar_features` for an example on
23932393
the usage of *xerr* and *yerr*.
23942394
2395-
ecolor : color or list of color, default: 'black'
2395+
ecolor : :mpltype:`color` or list of :mpltype:`color`, default: 'black'
23962396
The line color of the errorbars.
23972397
23982398
capsize : float, default: :rc:`errorbar.capsize`
@@ -2670,10 +2670,10 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
26702670
26712671
Other Parameters
26722672
----------------
2673-
color : color or list of color, optional
2673+
color : :mpltype:`color` or list of :mpltype:`color`, optional
26742674
The colors of the bar faces.
26752675
2676-
edgecolor : color or list of color, optional
2676+
edgecolor : :mpltype:`color` or list of :mpltype:`color`, optional
26772677
The colors of the bar edges.
26782678
26792679
linewidth : float or array-like, optional
@@ -2705,7 +2705,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
27052705
See :doc:`/gallery/statistics/errorbar_features` for an example on
27062706
the usage of *xerr* and *yerr*.
27072707
2708-
ecolor : color or list of color, default: 'black'
2708+
ecolor : :mpltype:`color` or list of :mpltype:`color`, default: 'black'
27092709
The line color of the errorbars.
27102710
27112711
capsize : float, default: :rc:`errorbar.capsize`
@@ -3163,7 +3163,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
31633163
labels : list, default: None
31643164
A sequence of strings providing the labels for each wedge
31653165
3166-
colors : color or array-like of color, default: None
3166+
colors : :mpltype:`color` or list of :mpltype:`color`, default: None
31673167
A sequence of colors through which the pie chart will cycle. If
31683168
*None*, will use the colors in the currently active cycle.
31693169
@@ -3458,7 +3458,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
34583458
Use 'none' (case-insensitive) to plot errorbars without any data
34593459
markers.
34603460
3461-
ecolor : color, default: None
3461+
ecolor : :mpltype:`color`, default: None
34623462
The color of the errorbar lines. If None, use the color of the
34633463
line connecting the markers.
34643464
@@ -4440,9 +4440,9 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
44404440
44414441
Parameters
44424442
----------
4443-
c : color or sequence or sequence of color or None
4443+
c : :mpltype:`color` or array-like or list of :mpltype:`color` or None
44444444
See argument description of `.Axes.scatter`.
4445-
edgecolors : color or sequence of color or {'face', 'none'} or None
4445+
edgecolors : :mpltype:`color` or sequence of color or {'face', 'none'} or None
44464446
See argument description of `.Axes.scatter`.
44474447
kwargs : dict
44484448
Additional kwargs. If these keys exist, we pop and process them:
@@ -4599,7 +4599,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
45994599
To eliminate the marker edge either set *linewidth=0* or
46004600
*edgecolor='none'*.
46014601
4602-
c : array-like or list of colors or color, optional
4602+
c : array-like or list of :mpltype:`color` or :mpltype:`color`, optional
46034603
The marker colors. Possible values:
46044604
46054605
- A scalar or sequence of n numbers to be mapped to colors using
@@ -4649,8 +4649,8 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
46494649
The linewidth of the marker edges. Note: The default *edgecolors*
46504650
is 'face'. You may want to change this as well.
46514651
4652-
edgecolors : {'face', 'none', *None*} or color or sequence of color, \
4653-
default: :rc:`scatter.edgecolors`
4652+
edgecolors : {'face', 'none', *None*} or :mpltype:`color` or list of \
4653+
:mpltype:`color`, default: :rc:`scatter.edgecolors`
46544654
The edge color of the marker. Possible values:
46554655
46564656
- 'face': The edge color will always be the same as the face color.
@@ -6762,7 +6762,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
67626762
log : bool, default: False
67636763
If ``True``, the histogram axis will be set to a log scale.
67646764
6765-
color : color or array-like of colors or None, default: None
6765+
color : :mpltype:`color` or list of :mpltype:`color` or None, default: None
67666766
Color or sequence of colors, one per dataset. Default (``None``)
67676767
uses the standard line color sequence.
67686768

lib/matplotlib/axes/_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ def set_facecolor(self, color):
15071507
15081508
Parameters
15091509
----------
1510-
color : color; see :ref:`colors_def`
1510+
color : :mpltype:`color`
15111511
"""
15121512
self._facecolor = color
15131513
self.stale = True
@@ -3379,17 +3379,17 @@ def tick_params(self, axis='both', **kwargs):
33793379
Tick length in points.
33803380
width : float
33813381
Tick width in points.
3382-
color : color
3382+
color : :mpltype:`color`
33833383
Tick color.
33843384
pad : float
33853385
Distance in points between tick and label.
33863386
labelsize : float or str
33873387
Tick label font size in points or as a string (e.g., 'large').
3388-
labelcolor : color
3388+
labelcolor : :mpltype:`color`
33893389
Tick label color.
33903390
labelfontfamily : str
33913391
Tick label font.
3392-
colors : color
3392+
colors : :mpltype:`color`
33933393
Tick color and label color.
33943394
zorder : float
33953395
Tick and label zorder.
@@ -3399,7 +3399,7 @@ def tick_params(self, axis='both', **kwargs):
33993399
Whether to draw the respective tick labels.
34003400
labelrotation : float
34013401
Tick label rotation
3402-
grid_color : color
3402+
grid_color : :mpltype:`color`
34033403
Gridline color.
34043404
grid_alpha : float
34053405
Transparency of gridlines: 0 (transparent) to 1 (opaque).

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def set_color(self, color):
263263
264264
Parameters
265265
----------
266-
color : color; see :ref:`colors_def`
266+
color : :mpltype:`color`
267267
"""
268268
axis = self._axis_map[self._orientation]
269269
axis.set_tick_params(colors=color)

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path,
192192
The locations to draw the markers.
193193
trans : `~matplotlib.transforms.Transform`
194194
An affine transform applied to the path.
195-
rgbFace : color, optional
195+
rgbFace : :mpltype:`color`, optional
196196
"""
197197
for vertices, codes in path.iter_segments(trans, simplify=False):
198198
if len(vertices):
@@ -930,7 +930,7 @@ def set_foreground(self, fg, isRGBA=False):
930930
931931
Parameters
932932
----------
933-
fg : color
933+
fg : :mpltype:`color`
934934
isRGBA : bool
935935
If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can be
936936
set to True to improve performance.
@@ -2085,11 +2085,11 @@ def print_figure(
20852085
dpi : float, default: :rc:`savefig.dpi`
20862086
The dots per inch to save the figure in.
20872087
2088-
facecolor : color or 'auto', default: :rc:`savefig.facecolor`
2088+
facecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.facecolor`
20892089
The facecolor of the figure. If 'auto', use the current figure
20902090
facecolor.
20912091
2092-
edgecolor : color or 'auto', default: :rc:`savefig.edgecolor`
2092+
edgecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.edgecolor`
20932093
The edgecolor of the figure. If 'auto', use the current figure
20942094
edgecolor.
20952095

lib/matplotlib/collections.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ def __init__(self, *,
9696
"""
9797
Parameters
9898
----------
99-
edgecolors : color or list of colors, default: :rc:`patch.edgecolor`
99+
edgecolors : :mpltype:`color` or list of colors, default: :rc:`patch.edgecolor`
100100
Edge color for each patch making up the collection. The special
101101
value 'face' can be passed to make the edgecolor match the
102102
facecolor.
103-
facecolors : color or list of colors, default: :rc:`patch.facecolor`
103+
facecolors : :mpltype:`color` or list of colors, default: :rc:`patch.facecolor`
104104
Face color for each patch making up the collection.
105105
linewidths : float or list of floats, default: :rc:`patch.linewidth`
106106
Line width for each patch making up the collection.
@@ -748,7 +748,7 @@ def set_color(self, c):
748748
749749
Parameters
750750
----------
751-
c : color or list of RGBA tuples
751+
c : :mpltype:`color` or list of RGBA tuples
752752
753753
See Also
754754
--------
@@ -779,7 +779,7 @@ def set_facecolor(self, c):
779779
780780
Parameters
781781
----------
782-
c : color or list of colors
782+
c : :mpltype:`color` or list of :mpltype:`color`
783783
"""
784784
if isinstance(c, str) and c.lower() in ("none", "face"):
785785
c = c.lower()
@@ -824,7 +824,7 @@ def set_edgecolor(self, c):
824824
825825
Parameters
826826
----------
827-
c : color or list of colors or 'face'
827+
c : :mpltype:`color` or list of :mpltype:`color` or 'face'
828828
The collection edgecolor(s). If a sequence, the patches cycle
829829
through it. If 'face', match the facecolor.
830830
"""
@@ -1371,15 +1371,15 @@ def __init__(self, segments, # Can be None.
13711371
can have a different number of segments.
13721372
linewidths : float or list of float, default: :rc:`lines.linewidth`
13731373
The width of each line in points.
1374-
colors : color or list of color, default: :rc:`lines.color`
1374+
colors : :mpltype:`color` or list of color, default: :rc:`lines.color`
13751375
A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not
13761376
allowed).
13771377
antialiaseds : bool or list of bool, default: :rc:`lines.antialiased`
13781378
Whether to use antialiasing for each line.
13791379
zorder : float, default: 2
13801380
zorder of the lines once drawn.
13811381
1382-
facecolors : color or list of color, default: 'none'
1382+
facecolors : :mpltype:`color` or list of :mpltype:`color`, default: 'none'
13831383
When setting *facecolors*, each line is interpreted as a boundary
13841384
for an area, implicitly closing the path from the last point to the
13851385
first point. The enclosed area is filled with *facecolor*.
@@ -1458,7 +1458,7 @@ def set_color(self, c):
14581458
14591459
Parameters
14601460
----------
1461-
c : color or list of colors
1461+
c : :mpltype:`color` or list of :mpltype:`color`
14621462
Single color (all lines have same color), or a
14631463
sequence of RGBA tuples; if it is a sequence the lines will
14641464
cycle through the sequence.
@@ -1486,7 +1486,7 @@ def set_gapcolor(self, gapcolor):
14861486
14871487
Parameters
14881488
----------
1489-
gapcolor : color or list of colors or None
1489+
gapcolor : :mpltype:`color` or list of :mpltype:`color` or None
14901490
The color with which to fill the gaps. If None, the gaps are
14911491
unfilled.
14921492
"""
@@ -1559,7 +1559,7 @@ def __init__(self,
15591559
``lineoffset - linelength/2`` to ``lineoffset + linelength/2``).
15601560
linewidth : float or list thereof, default: :rc:`lines.linewidth`
15611561
The line width of the event lines, in points.
1562-
color : color or list of colors, default: :rc:`lines.color`
1562+
color : :mpltype:`color` or list of :mpltype:`color`, default: :rc:`lines.color`
15631563
The color of the event lines.
15641564
linestyle : str or tuple or list thereof, default: 'solid'
15651565
Valid strings are ['solid', 'dashed', 'dashdot', 'dotted',

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def add_lines(self, *args, **kwargs):
730730
----------
731731
levels : array-like
732732
The positions of the lines.
733-
colors : color or list of colors
733+
colors : :mpltype:`color` or list of :mpltype:`color`
734734
Either a single color applying to all lines or one color value for
735735
each line.
736736
linewidths : float or array-like

lib/matplotlib/colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def register(self, name, color_list):
164164
name : str
165165
The name for the color sequence.
166166
167-
color_list : list of colors
167+
color_list : list of :mpltype:`color`
168168
An iterable returning valid Matplotlib colors when iterating over.
169169
Note however that the returned color sequence will always be a
170170
list regardless of the input type.
@@ -1047,7 +1047,7 @@ def from_list(name, colors, N=256, gamma=1.0):
10471047
----------
10481048
name : str
10491049
The name of the colormap.
1050-
colors : array-like of colors or array-like of (value, color)
1050+
colors : list of :mpltype:`color` or list of (value, color)
10511051
If only colors are given, they are equidistantly mapped from the
10521052
range :math:`[0, 1]`; i.e. 0 maps to ``colors[0]`` and 1 maps to
10531053
``colors[-1]``.

lib/matplotlib/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def clabel(self, levels=None, *,
7878
Size in points or relative size e.g., 'smaller', 'x-large'.
7979
See `.Text.set_size` for accepted string values.
8080
81-
colors : color or colors or None, default: None
81+
colors : :mpltype:`color` or colors or None, default: None
8282
The label colors:
8383
8484
- If *None*, the color of each label matches the color of
@@ -1653,7 +1653,7 @@ def _initialize_x_y(self, z):
16531653
nearest those points are always masked out, other triangular
16541654
corners comprising three unmasked points are contoured as usual.
16551655
1656-
colors : color string or sequence of colors, optional
1656+
colors : :mpltype:`color` or list of :mpltype:`color`, optional
16571657
The colors of the levels, i.e. the lines for `.contour` and the
16581658
areas for `.contourf`.
16591659

lib/matplotlib/figure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def set_edgecolor(self, color):
397397
398398
Parameters
399399
----------
400-
color : color; see :ref:`colors_def`
400+
color : :mpltype:`color`
401401
"""
402402
self.patch.set_edgecolor(color)
403403

@@ -407,7 +407,7 @@ def set_facecolor(self, color):
407407
408408
Parameters
409409
----------
410-
color : color; see :ref:`colors_def`
410+
color : :mpltype:`color`
411411
"""
412412
self.patch.set_facecolor(color)
413413

@@ -3261,11 +3261,11 @@ def savefig(self, fname, *, transparent=None, **kwargs):
32613261
compressed layout engine; ignored if one of those engines is not in
32623262
use.
32633263
3264-
facecolor : color or 'auto', default: :rc:`savefig.facecolor`
3264+
facecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.facecolor`
32653265
The facecolor of the figure. If 'auto', use the current figure
32663266
facecolor.
32673267
3268-
edgecolor : color or 'auto', default: :rc:`savefig.edgecolor`
3268+
edgecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.edgecolor`
32693269
The edgecolor of the figure. If 'auto', use the current figure
32703270
edgecolor.
32713271

0 commit comments

Comments
 (0)