From 7344ffdadd2af40eb0fec9c6c63edb0a263ba53f Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:52:13 +0100 Subject: [PATCH 1/2] DOC: fix :mpltype:`color` role `inline.interpreted()` already returns a list of nodes. We mustn't wrap it in another list. --- doc/sphinxext/custom_roles.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/sphinxext/custom_roles.py b/doc/sphinxext/custom_roles.py index 8961037ed0f1..d76c92709865 100644 --- a/doc/sphinxext/custom_roles.py +++ b/doc/sphinxext/custom_roles.py @@ -72,9 +72,8 @@ def mpltype_role(name, rawtext, text, lineno, inliner, options={}, content=[]): if mpltype not in type_to_link_target: raise ValueError(f"Unknown mpltype: {mpltype!r}") - ref_nodes, messages = inliner.interpreted( + node_list, messages = inliner.interpreted( mpltype, f'{mpltype} <{type_to_link_target[mpltype]}>', 'ref', lineno) - node_list = [ref_nodes] return node_list, messages From ab8e59029abef87f24b6066f698a55494274796a Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 22 Dec 2023 10:02:29 +0100 Subject: [PATCH 2/2] Use :mpltype:`color` for color types --- lib/matplotlib/axes/_axes.py | 38 +++++++++---------- lib/matplotlib/axes/_base.py | 10 ++--- lib/matplotlib/axes/_secondary_axes.py | 2 +- lib/matplotlib/backend_bases.py | 8 ++-- lib/matplotlib/collections.py | 20 +++++----- lib/matplotlib/colorbar.py | 2 +- lib/matplotlib/colors.py | 4 +- lib/matplotlib/contour.py | 4 +- lib/matplotlib/figure.py | 8 ++-- lib/matplotlib/lines.py | 10 ++--- lib/matplotlib/patches.py | 6 +-- lib/matplotlib/patheffects.py | 4 +- lib/matplotlib/pyplot.py | 4 +- lib/matplotlib/quiver.py | 10 ++--- lib/matplotlib/spines.py | 2 +- lib/matplotlib/stackplot.py | 2 +- lib/matplotlib/streamplot.py | 2 +- lib/matplotlib/table.py | 10 ++--- lib/matplotlib/text.py | 4 +- lib/matplotlib/tri/_tricontour.py | 2 +- lib/matplotlib/widgets.py | 20 +++++----- lib/mpl_toolkits/axisartist/axisline_style.py | 2 +- lib/mpl_toolkits/mplot3d/axes3d.py | 8 ++-- lib/mpl_toolkits/mplot3d/axis3d.py | 2 +- 24 files changed, 92 insertions(+), 92 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 3a1cc2fb9fb6..b06832767b76 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -427,10 +427,10 @@ def indicate_inset(self, bounds, inset_ax=None, *, transform=None, `ax.transAxes`, i.e. the units of *rect* are in Axes-relative coordinates. - facecolor : color, default: 'none' + facecolor : :mpltype:`color`, default: 'none' Facecolor of the rectangle. - edgecolor : color, default: '0.5' + edgecolor : :mpltype:`color`, default: '0.5' Color of the rectangle and color of the connecting lines. alpha : float, default: 0.5 @@ -1073,7 +1073,7 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid', Respective beginning and end of each line. If scalars are provided, all lines will have the same length. - colors : color or list of colors, default: :rc:`lines.color` + colors : :mpltype:`color` or list of color , default: :rc:`lines.color` linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, default: 'solid' @@ -1164,7 +1164,7 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid', Respective beginning and end of each line. If scalars are provided, all lines will have the same length. - colors : color or list of colors, default: :rc:`lines.color` + colors : :mpltype:`color` or list of color, default: :rc:`lines.color` linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, default: 'solid' @@ -1300,7 +1300,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1, If *positions* is 2D, this can be a sequence with length matching the length of *positions*. - colors : color or list of colors, default: :rc:`lines.color` + colors : :mpltype:`color` or list of color, default: :rc:`lines.color` The color(s) of the event lines. If *positions* is 2D, this can be a sequence with length matching @@ -2333,10 +2333,10 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", Other Parameters ---------------- - color : color or list of color, optional + color : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the bar faces. - edgecolor : color or list of color, optional + edgecolor : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the bar edges. linewidth : float or array-like, optional @@ -2368,7 +2368,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", See :doc:`/gallery/statistics/errorbar_features` for an example on the usage of *xerr* and *yerr*. - ecolor : color or list of color, default: 'black' + ecolor : :mpltype:`color` or list of :mpltype:`color`, default: 'black' The line color of the errorbars. capsize : float, default: :rc:`errorbar.capsize` @@ -2646,10 +2646,10 @@ def barh(self, y, width, height=0.8, left=None, *, align="center", Other Parameters ---------------- - color : color or list of color, optional + color : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the bar faces. - edgecolor : color or list of color, optional + edgecolor : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the bar edges. linewidth : float or array-like, optional @@ -2681,7 +2681,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center", See :doc:`/gallery/statistics/errorbar_features` for an example on the usage of *xerr* and *yerr*. - ecolor : color or list of color, default: 'black' + ecolor : :mpltype:`color` or list of :mpltype:`color`, default: 'black' The line color of the errorbars. capsize : float, default: :rc:`errorbar.capsize` @@ -3139,7 +3139,7 @@ def pie(self, x, explode=None, labels=None, colors=None, labels : list, default: None A sequence of strings providing the labels for each wedge - colors : color or array-like of color, default: None + colors : :mpltype:`color` or list of :mpltype:`color`, default: None A sequence of colors through which the pie chart will cycle. If *None*, will use the colors in the currently active cycle. @@ -3434,7 +3434,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, Use 'none' (case-insensitive) to plot errorbars without any data markers. - ecolor : color, default: None + ecolor : :mpltype:`color`, default: None The color of the errorbar lines. If None, use the color of the line connecting the markers. @@ -4416,9 +4416,9 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize, Parameters ---------- - c : color or sequence or sequence of color or None + c : :mpltype:`color` or array-like or list of :mpltype:`color` or None See argument description of `.Axes.scatter`. - edgecolors : color or sequence of color or {'face', 'none'} or None + edgecolors : :mpltype:`color` or sequence of color or {'face', 'none'} or None See argument description of `.Axes.scatter`. kwargs : dict Additional kwargs. If these keys exist, we pop and process them: @@ -4575,7 +4575,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, To eliminate the marker edge either set *linewidth=0* or *edgecolor='none'*. - c : array-like or list of colors or color, optional + c : array-like or list of :mpltype:`color` or :mpltype:`color`, optional The marker colors. Possible values: - A scalar or sequence of n numbers to be mapped to colors using @@ -4625,8 +4625,8 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, The linewidth of the marker edges. Note: The default *edgecolors* is 'face'. You may want to change this as well. - edgecolors : {'face', 'none', *None*} or color or sequence of color, \ -default: :rc:`scatter.edgecolors` + edgecolors : {'face', 'none', *None*} or :mpltype:`color` or list of \ +:mpltype:`color`, default: :rc:`scatter.edgecolors` The edge color of the marker. Possible values: - 'face': The edge color will always be the same as the face color. @@ -6738,7 +6738,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, log : bool, default: False If ``True``, the histogram axis will be set to a log scale. - color : color or array-like of colors or None, default: None + color : :mpltype:`color` or list of :mpltype:`color` or None, default: None Color or sequence of colors, one per dataset. Default (``None``) uses the standard line color sequence. diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 0617fc7681bd..5d612c581270 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1507,7 +1507,7 @@ def set_facecolor(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` """ self._facecolor = color self.stale = True @@ -3379,17 +3379,17 @@ def tick_params(self, axis='both', **kwargs): Tick length in points. width : float Tick width in points. - color : color + color : :mpltype:`color` Tick color. pad : float Distance in points between tick and label. labelsize : float or str Tick label font size in points or as a string (e.g., 'large'). - labelcolor : color + labelcolor : :mpltype:`color` Tick label color. labelfontfamily : str Tick label font. - colors : color + colors : :mpltype:`color` Tick color and label color. zorder : float Tick and label zorder. @@ -3399,7 +3399,7 @@ def tick_params(self, axis='both', **kwargs): Whether to draw the respective tick labels. labelrotation : float Tick label rotation - grid_color : color + grid_color : :mpltype:`color` Gridline color. grid_alpha : float Transparency of gridlines: 0 (transparent) to 1 (opaque). diff --git a/lib/matplotlib/axes/_secondary_axes.py b/lib/matplotlib/axes/_secondary_axes.py index 81333a8a201c..c63738f01561 100644 --- a/lib/matplotlib/axes/_secondary_axes.py +++ b/lib/matplotlib/axes/_secondary_axes.py @@ -240,7 +240,7 @@ def set_color(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` """ axis = self._axis_map[self._orientation] axis.set_tick_params(colors=color) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index a353500f8725..d25f3c636fe3 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -218,7 +218,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path, The locations to draw the markers. trans : `~matplotlib.transforms.Transform` An affine transform applied to the path. - rgbFace : color, optional + rgbFace : :mpltype:`color`, optional """ for vertices, codes in path.iter_segments(trans, simplify=False): if len(vertices): @@ -956,7 +956,7 @@ def set_foreground(self, fg, isRGBA=False): Parameters ---------- - fg : color + fg : :mpltype:`color` isRGBA : bool If *fg* is known to be an ``(r, g, b, a)`` tuple, *isRGBA* can be set to True to improve performance. @@ -2111,11 +2111,11 @@ def print_figure( dpi : float, default: :rc:`savefig.dpi` The dots per inch to save the figure in. - facecolor : color or 'auto', default: :rc:`savefig.facecolor` + facecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.facecolor` The facecolor of the figure. If 'auto', use the current figure facecolor. - edgecolor : color or 'auto', default: :rc:`savefig.edgecolor` + edgecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.edgecolor` The edgecolor of the figure. If 'auto', use the current figure edgecolor. diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 5cbffff314b6..3724cf506ed9 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -96,11 +96,11 @@ def __init__(self, *, """ Parameters ---------- - edgecolors : color or list of colors, default: :rc:`patch.edgecolor` + edgecolors : :mpltype:`color` or list of colors, default: :rc:`patch.edgecolor` Edge color for each patch making up the collection. The special value 'face' can be passed to make the edgecolor match the facecolor. - facecolors : color or list of colors, default: :rc:`patch.facecolor` + facecolors : :mpltype:`color` or list of colors, default: :rc:`patch.facecolor` Face color for each patch making up the collection. linewidths : float or list of floats, default: :rc:`patch.linewidth` Line width for each patch making up the collection. @@ -745,7 +745,7 @@ def set_color(self, c): Parameters ---------- - c : color or list of RGBA tuples + c : :mpltype:`color` or list of RGBA tuples See Also -------- @@ -776,7 +776,7 @@ def set_facecolor(self, c): Parameters ---------- - c : color or list of colors + c : :mpltype:`color` or list of :mpltype:`color` """ if isinstance(c, str) and c.lower() in ("none", "face"): c = c.lower() @@ -821,7 +821,7 @@ def set_edgecolor(self, c): Parameters ---------- - c : color or list of colors or 'face' + c : :mpltype:`color` or list of :mpltype:`color` or 'face' The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor. """ @@ -1368,7 +1368,7 @@ def __init__(self, segments, # Can be None. can have a different number of segments. linewidths : float or list of float, default: :rc:`lines.linewidth` The width of each line in points. - colors : color or list of color, default: :rc:`lines.color` + colors : :mpltype:`color` or list of color, default: :rc:`lines.color` A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not allowed). antialiaseds : bool or list of bool, default: :rc:`lines.antialiased` @@ -1376,7 +1376,7 @@ def __init__(self, segments, # Can be None. zorder : float, default: 2 zorder of the lines once drawn. - facecolors : color or list of color, default: 'none' + facecolors : :mpltype:`color` or list of :mpltype:`color`, default: 'none' When setting *facecolors*, each line is interpreted as a boundary for an area, implicitly closing the path from the last point to the first point. The enclosed area is filled with *facecolor*. @@ -1455,7 +1455,7 @@ def set_color(self, c): Parameters ---------- - c : color or list of colors + c : :mpltype:`color` or list of :mpltype:`color` Single color (all lines have same color), or a sequence of RGBA tuples; if it is a sequence the lines will cycle through the sequence. @@ -1483,7 +1483,7 @@ def set_gapcolor(self, gapcolor): Parameters ---------- - gapcolor : color or list of colors or None + gapcolor : :mpltype:`color` or list of :mpltype:`color` or None The color with which to fill the gaps. If None, the gaps are unfilled. """ @@ -1556,7 +1556,7 @@ def __init__(self, ``lineoffset - linelength/2`` to ``lineoffset + linelength/2``). linewidth : float or list thereof, default: :rc:`lines.linewidth` The line width of the event lines, in points. - color : color or list of colors, default: :rc:`lines.color` + color : :mpltype:`color` or list of :mpltype:`color`, default: :rc:`lines.color` The color of the event lines. linestyle : str or tuple or list thereof, default: 'solid' Valid strings are ['solid', 'dashed', 'dashdot', 'dotted', diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index e09cdead7392..af61e4671ff4 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -730,7 +730,7 @@ def add_lines(self, *args, **kwargs): ---------- levels : array-like The positions of the lines. - colors : color or list of colors + colors : :mpltype:`color` or list of :mpltype:`color` Either a single color applying to all lines or one color value for each line. linewidths : float or array-like diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 9a493c928fdb..ed59a6e2178d 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -164,7 +164,7 @@ def register(self, name, color_list): name : str The name for the color sequence. - color_list : list of colors + color_list : list of :mpltype:`color` An iterable returning valid Matplotlib colors when iterating over. Note however that the returned color sequence will always be a list regardless of the input type. @@ -1042,7 +1042,7 @@ def from_list(name, colors, N=256, gamma=1.0): ---------- name : str The name of the colormap. - colors : array-like of colors or array-like of (value, color) + colors : list of :mpltype:`color` or list of (value, color) If only colors are given, they are equidistantly mapped from the range :math:`[0, 1]`; i.e. 0 maps to ``colors[0]`` and 1 maps to ``colors[-1]``. diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index ab550b5d2acf..90167bd320e8 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -78,7 +78,7 @@ def clabel(self, levels=None, *, Size in points or relative size e.g., 'smaller', 'x-large'. See `.Text.set_size` for accepted string values. - colors : color or colors or None, default: None + colors : :mpltype:`color` or colors or None, default: None The label colors: - If *None*, the color of each label matches the color of @@ -1653,7 +1653,7 @@ def _initialize_x_y(self, z): nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual. -colors : color string or sequence of colors, optional +colors : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the levels, i.e. the lines for `.contour` and the areas for `.contourf`. diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 12ab090288a5..087c193d48c3 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -397,7 +397,7 @@ def set_edgecolor(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` """ self.patch.set_edgecolor(color) @@ -407,7 +407,7 @@ def set_facecolor(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` """ self.patch.set_facecolor(color) @@ -3261,11 +3261,11 @@ def savefig(self, fname, *, transparent=None, **kwargs): compressed layout engine; ignored if one of those engines is not in use. - facecolor : color or 'auto', default: :rc:`savefig.facecolor` + facecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.facecolor` The facecolor of the figure. If 'auto', use the current figure facecolor. - edgecolor : color or 'auto', default: :rc:`savefig.edgecolor` + edgecolor : :mpltype:`color` or 'auto', default: :rc:`savefig.edgecolor` The edgecolor of the figure. If 'auto', use the current figure edgecolor. diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 5e5c19c9f69f..6e0d027c5c90 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -1056,7 +1056,7 @@ def set_color(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` """ mcolors._check_color_like(color=color) self._color = color @@ -1111,7 +1111,7 @@ def set_gapcolor(self, gapcolor): Parameters ---------- - gapcolor : color or None + gapcolor : :mpltype:`color` or None The color with which to fill the gaps. If None, the gaps are unfilled. """ @@ -1214,7 +1214,7 @@ def set_markeredgecolor(self, ec): Parameters ---------- - ec : color + ec : :mpltype:`color` """ self._set_markercolor("markeredgecolor", True, ec) @@ -1224,7 +1224,7 @@ def set_markerfacecolor(self, fc): Parameters ---------- - fc : color + fc : :mpltype:`color` """ self._set_markercolor("markerfacecolor", True, fc) @@ -1234,7 +1234,7 @@ def set_markerfacecoloralt(self, fc): Parameters ---------- - fc : color + fc : :mpltype:`color` """ self._set_markercolor("markerfacecoloralt", False, fc) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index e7ad848b3e49..b5be74af781a 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -379,7 +379,7 @@ def set_edgecolor(self, color): Parameters ---------- - color : color or None; see :ref:`colors_def` + color : :mpltype:`color` or None """ self._original_edgecolor = color self._set_edgecolor(color) @@ -397,7 +397,7 @@ def set_facecolor(self, color): Parameters ---------- - color : color or None; see :ref:`colors_def` + color : :mpltype:`color` or None """ self._original_facecolor = color self._set_facecolor(color) @@ -408,7 +408,7 @@ def set_color(self, c): Parameters ---------- - c : color + c : :mpltype:`color` See Also -------- diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py index 5bb4c8e2a501..110868717936 100644 --- a/lib/matplotlib/patheffects.py +++ b/lib/matplotlib/patheffects.py @@ -228,7 +228,7 @@ def __init__(self, offset=(2, -2), ---------- offset : (float, float), default: (2, -2) The (x, y) offset of the shadow in points. - shadow_rgbFace : color + shadow_rgbFace : :mpltype:`color` The shadow color. alpha : float, default: 0.3 The alpha transparency of the created shadow patch. @@ -295,7 +295,7 @@ def __init__(self, offset=(2, -2), ---------- offset : (float, float), default: (2, -2) The (x, y) offset to apply to the path, in points. - shadow_color : color, default: 'black' + shadow_color : :mpltype:`color`, default: 'black' The shadow color. A value of ``None`` takes the original artist's color with a scale factor of *rho*. diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index c5044fe7242f..249e1bcdec80 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -822,10 +822,10 @@ def figure( dpi : float, default: :rc:`figure.dpi` The resolution of the figure in dots-per-inch. - facecolor : color, default: :rc:`figure.facecolor` + facecolor : :mpltype:`color`, default: :rc:`figure.facecolor` The background color. - edgecolor : color, default: :rc:`figure.edgecolor` + edgecolor : :mpltype:`color`, default: :rc:`figure.edgecolor` The border color. frameon : bool, default: True diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index 20e4f15dd903..db4ef35f3034 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -179,7 +179,7 @@ Minimum length as a multiple of shaft width; if an arrow length is less than this, plot a dot (hexagon) of this diameter instead. -color : color or color sequence, optional +color : :mpltype:`color` or list :mpltype:`color`, optional Explicit color(s) for the arrows. If *C* has been set, *color* has no effect. @@ -271,14 +271,14 @@ def __init__(self, Q, X, Y, U, label, (used for the locations of the vectors in the quiver plot itself); 'inches' is position in the figure in inches, with (0, 0) at the lower left corner. - color : color + color : :mpltype:`color` Overrides face and edge colors from *Q*. labelpos : {'N', 'S', 'E', 'W'} Position the label above, below, to the right, to the left of the arrow, respectively. labelsep : float, default: 0.1 Distance in inches between the arrow and the label. - labelcolor : color, default: :rc:`text.color` + labelcolor : :mpltype:`color`, default: :rc:`text.color` Label color. fontproperties : dict, optional A dictionary with keyword arguments accepted by the @@ -796,12 +796,12 @@ def _h_arrows(self, length): rotates about this point. This can also be a number, which shifts the start of the barb that many points away from grid point. -barbcolor : color or color sequence +barbcolor : :mpltype:`color` or color sequence The color of all parts of the barb except for the flags. This parameter is analogous to the *edgecolor* parameter for polygons, which can be used instead. However this parameter will override facecolor. -flagcolor : color or color sequence +flagcolor : :mpltype:`color` or color sequence The color of any flags on the barb. This parameter is analogous to the *facecolor* parameter for polygons, which can be used instead. However, this parameter will override facecolor. If this is not set (and *C* has diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index 9077ae478d71..39cb99c53d72 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -472,7 +472,7 @@ def set_color(self, c): Parameters ---------- - c : color + c : :mpltype:`color` Notes ----- diff --git a/lib/matplotlib/stackplot.py b/lib/matplotlib/stackplot.py index 4e933f52887d..0d9b896f6f4c 100644 --- a/lib/matplotlib/stackplot.py +++ b/lib/matplotlib/stackplot.py @@ -47,7 +47,7 @@ def stackplot(axes, x, *args, A sequence of labels to assign to each data series. If unspecified, then no labels will be applied to artists. - colors : list of color, optional + colors : list of :mpltype:`color`, optional A sequence of colors to be cycled through and used to color the stacked areas. The sequence need not be exactly the same length as the number of provided *y*, in which case the colors will repeat from the diff --git a/lib/matplotlib/streamplot.py b/lib/matplotlib/streamplot.py index daae8fc5b35c..84f99732c709 100644 --- a/lib/matplotlib/streamplot.py +++ b/lib/matplotlib/streamplot.py @@ -42,7 +42,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, The width of the streamlines. With a 2D array the line width can be varied across the grid. The array must have the same shape as *u* and *v*. - color : color or 2D array + color : :mpltype:`color` or 2D array The streamline color. If given an array, its values are converted to colors using *cmap* and *norm*. The array must have the same shape as *u* and *v*. diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index ff7fb06c0d08..7d8c8ec4c3f4 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -70,9 +70,9 @@ def __init__(self, xy, width, height, *, The cell width. height : float The cell height. - edgecolor : color, default: 'k' + edgecolor : :mpltype:`color`, default: 'k' The color of the cell border. - facecolor : color, default: 'w' + facecolor : :mpltype:`color`, default: 'w' The cell facecolor. fill : bool, default: True Whether the cell background is filled. @@ -681,7 +681,7 @@ def table(ax, *Note*: Line breaks in the strings are currently not accounted for and will result in the text exceeding the cell boundaries. - cellColours : 2D list of colors, optional + cellColours : 2D list of :mpltype:`color`, optional The background colors of the cells. cellLoc : {'right', 'center', 'left'} @@ -694,7 +694,7 @@ def table(ax, rowLabels : list of str, optional The text of the row header cells. - rowColours : list of colors, optional + rowColours : list of :mpltype:`color`, optional The colors of the row header cells. rowLoc : {'left', 'center', 'right'} @@ -703,7 +703,7 @@ def table(ax, colLabels : list of str, optional The text of the column header cells. - colColours : list of colors, optional + colColours : list of :mpltype:`color`, optional The colors of the column header cells. colLoc : {'center', 'left', 'right'} diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index 5a40a808e36d..e1f3a88809de 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -965,7 +965,7 @@ def set_backgroundcolor(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` See Also -------- @@ -985,7 +985,7 @@ def set_color(self, color): Parameters ---------- - color : color; see :ref:`colors_def` + color : :mpltype:`color` """ # "auto" is only supported by axisartist, but we can just let it error # out at draw time for simplicity. diff --git a/lib/matplotlib/tri/_tricontour.py b/lib/matplotlib/tri/_tricontour.py index 5b6d745372f8..5dc1eb81593c 100644 --- a/lib/matplotlib/tri/_tricontour.py +++ b/lib/matplotlib/tri/_tricontour.py @@ -130,7 +130,7 @@ def _contour_args(self, args, kwargs): Other Parameters ---------------- -colors : color string or sequence of colors, optional +colors : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the levels, i.e., the contour %%(type)s. The sequence is cycled for the levels in ascending order. If the sequence diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 4aab281c5291..88eafcd21a9e 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -193,7 +193,7 @@ def __init__(self, ax, label, image=None, directly forwarded to `~.axes.Axes.imshow`. color : :mpltype:`color` The color of the button when not activated. - hovercolor : color + hovercolor : :mpltype:`color` The color of the button when the mouse is over it. useblit : bool, default: True Use blitting for faster drawing if supported by the backend. @@ -406,11 +406,11 @@ def __init__(self, ax, label, valmin, valmax, *, valinit=0.5, valfmt=None, orientation : {'horizontal', 'vertical'}, default: 'horizontal' The orientation of the slider. - initcolor : color, default: 'r' + initcolor : :mpltype:`color`, default: 'r' The color of the line at the *valinit* position. Set to ``'none'`` for no line. - track_color : color, default: 'lightgrey' + track_color : :mpltype:`color`, default: 'lightgrey' The color of the background track. The track is accessible for further styling via the *track* attribute. @@ -678,7 +678,7 @@ def __init__( orientation : {'horizontal', 'vertical'}, default: 'horizontal' The orientation of the slider. - track_color : color, default: 'lightgrey' + track_color : :mpltype:`color`, default: 'lightgrey' The color of the background track. The track is accessible for further styling via the *track* attribute. @@ -1312,9 +1312,9 @@ class TextBox(AxesWidget): The parent Axes for the widget. label : `~matplotlib.text.Text` - color : color + color : :mpltype:`color` The color of the text box when not hovering. - hovercolor : color + hovercolor : :mpltype:`color` The color of the text box when hovering. """ @@ -1330,9 +1330,9 @@ def __init__(self, ax, label, initial='', *, Label for this text box. initial : str Initial value in the text box. - color : color + color : :mpltype:`color` The color of the box. - hovercolor : color + hovercolor : :mpltype:`color` The color of the box when the mouse is over it. label_pad : float The distance between the label and the right side of the textbox. @@ -1567,7 +1567,7 @@ class RadioButtons(AxesWidget): ---------- ax : `~matplotlib.axes.Axes` The parent Axes for the widget. - activecolor : color + activecolor : :mpltype:`color` The color of the selected button. labels : list of `.Text` The button labels. @@ -1592,7 +1592,7 @@ def __init__(self, ax, labels, active=0, activecolor=None, *, The button labels. active : int The index of the initially selected button. - activecolor : color + activecolor : :mpltype:`color` The color of the selected button. The default is ``'blue'`` if not specified here or in *radio_props*. useblit : bool, default: True diff --git a/lib/mpl_toolkits/axisartist/axisline_style.py b/lib/mpl_toolkits/axisartist/axisline_style.py index 5ae188021bb8..7f25b98082ef 100644 --- a/lib/mpl_toolkits/axisartist/axisline_style.py +++ b/lib/mpl_toolkits/axisartist/axisline_style.py @@ -171,7 +171,7 @@ def __init__(self, size=1, facecolor=None): ---------- size : float Size of the arrow as a fraction of the ticklabel size. - facecolor : color, default: :rc:`axes.edgecolor` + facecolor : :mpltype:`color`, default: :rc:`axes.edgecolor` Fill color. .. versionadded:: 3.7 diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 74348d17730d..9a3c13daad6b 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -1940,13 +1940,13 @@ def plot_surface(self, X, Y, Z, *, norm=None, vmin=None, 'classic' mode uses a default of ``rstride = cstride = 10`` instead of the new default of ``rcount = ccount = 50``. - color : color-like + color : :mpltype:`color` Color of the surface patches. cmap : Colormap, optional Colormap of the surface patches. - facecolors : array-like of colors + facecolors : list of :mpltype:`color` Colors of each individual patch. norm : `~matplotlib.colors.Normalize`, optional @@ -2613,7 +2613,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, The marker size in points**2. Either an array of the same length as *xs* and *ys* or a single value to make all markers the same size. - c : color, sequence, or sequence of colors, optional + c : :mpltype:`color`, sequence, or sequence of colors, optional The marker color. Possible values: - A single color format string. @@ -3260,7 +3260,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='', Use 'none' (case-insensitive) to plot errorbars without any data markers. - ecolor : color, default: None + ecolor : :mpltype:`color`, default: None The color of the errorbar lines. If None, use the color of the line connecting the markers. diff --git a/lib/mpl_toolkits/mplot3d/axis3d.py b/lib/mpl_toolkits/mplot3d/axis3d.py index 7b738b705c2a..79b78657bdb9 100644 --- a/lib/mpl_toolkits/mplot3d/axis3d.py +++ b/lib/mpl_toolkits/mplot3d/axis3d.py @@ -250,7 +250,7 @@ def set_pane_color(self, color, alpha=None): Parameters ---------- - color : color + color : :mpltype:`color` Color for axis pane. alpha : float, optional Alpha value for axis pane. If None, base it on *color*.