Skip to content

Commit ff57c0f

Browse files
committed
DOC: Add descriptions to matplotlib.typing
1 parent b7e7663 commit ff57c0f

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

doc/api/typing_api.rst

+19-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,33 @@
22
``matplotlib.typing``
33
*********************
44

5+
.. automodule:: matplotlib.typing
6+
:no-members:
7+
:no-undoc-members:
8+
9+
Color
10+
=====
11+
12+
.. autodata:: matplotlib.typing.ColorType
513
.. autodata:: matplotlib.typing.RGBColorType
6-
.. autodata:: matplotlib.typing.RGBColourType
714
.. autodata:: matplotlib.typing.RGBAColorType
8-
.. autodata:: matplotlib.typing.RGBAColourType
9-
.. autodata:: matplotlib.typing.ColorType
1015
.. autodata:: matplotlib.typing.ColourType
16+
.. autodata:: matplotlib.typing.RGBColourType
17+
.. autodata:: matplotlib.typing.RGBAColourType
18+
19+
Styles
20+
======
21+
1122
.. autodata:: matplotlib.typing.LineStyleType
1223
.. autodata:: matplotlib.typing.DrawStyleType
1324
.. autodata:: matplotlib.typing.MarkEveryType
1425
.. autodata:: matplotlib.typing.FillStyleType
1526
.. autodata:: matplotlib.typing.CapStyleType
1627
.. autodata:: matplotlib.typing.JoinStyleType
28+
29+
Other types
30+
===========
31+
32+
.. autodata:: matplotlib.typing.CoordsType
1733
.. autodata:: matplotlib.typing.RcStyleType
1834
.. autodata:: matplotlib.typing.HashableList
19-
:annotation: Nested list with Hashable values

lib/matplotlib/typing.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This module contains Type aliases which are useful for Matplotlib and potentially
55
downstream libraries.
66
7-
.. admonition:: Provisional status of typing
7+
.. warning:: Provisional status of typing
88
99
The ``typing`` module and type stub files are considered provisional and may change
1010
at any time without a deprecation period.
@@ -21,6 +21,8 @@
2121
from .transforms import Bbox, Transform
2222

2323
RGBColorType: TypeAlias = tuple[float, float, float] | str
24+
"""Any RGB color specification accepted by Matplotlib."""
25+
2426
RGBAColorType: TypeAlias = (
2527
str | # "none" or "#RRGGBBAA"/"#RGBA" hex strings
2628
tuple[float, float, float, float] |
@@ -30,31 +32,55 @@
3032
# (4-tuple, float) is odd, but accepted as the outer float overriding A of 4-tuple
3133
tuple[tuple[float, float, float, float], float]
3234
)
35+
"""Any RGBA color specification accepted by Matplotlib."""
3336

3437
ColorType: TypeAlias = RGBColorType | RGBAColorType
38+
"""Any color specification accepted by Matplotlib. See :mpltype:`color`."""
3539

3640
RGBColourType: TypeAlias = RGBColorType
41+
"""Alias of `.RGBColorType`."""
42+
3743
RGBAColourType: TypeAlias = RGBAColorType
44+
"""Alias of `.RGBAColorType`."""
45+
3846
ColourType: TypeAlias = ColorType
47+
"""Alias of `.ColorType`."""
3948

4049
LineStyleType: TypeAlias = (
4150
Literal["-", "solid", "--", "dashed", "-.", "dashdot", ":", "dotted",
4251
"", "none", " ", "None"] |
4352
tuple[float, Sequence[float]]
4453
)
54+
"""
55+
Any line style specification accepted by Matplotlib.
56+
See :doc:`/gallery/lines_bars_and_markers/linestyles`.
57+
"""
58+
4559
DrawStyleType: TypeAlias = Literal["default", "steps", "steps-pre", "steps-mid",
4660
"steps-post"]
61+
"""See :doc:`/gallery/lines_bars_and_markers/step_demo`."""
62+
4763
MarkEveryType: TypeAlias = (
4864
None |
4965
int | tuple[int, int] | slice | list[int] |
5066
float | tuple[float, float] |
5167
list[bool]
5268
)
69+
"""See :doc:`/gallery/lines_bars_and_markers/markevery_demo`."""
5370

5471
MarkerType: TypeAlias = str | path.Path | MarkerStyle
72+
"""
73+
Marker specification. See :doc:`/gallery/lines_bars_and_markers/marker_reference`.
74+
"""
75+
5576
FillStyleType: TypeAlias = Literal["full", "left", "right", "bottom", "top", "none"]
77+
"""Marker fill styles. See :doc:`/gallery/lines_bars_and_markers/marker_reference`."""
78+
5679
JoinStyleType: TypeAlias = JoinStyle | Literal["miter", "round", "bevel"]
80+
"""Line join styles. See :doc:`/gallery/lines_bars_and_markers/joinstyle`."""
81+
5782
CapStyleType: TypeAlias = CapStyle | Literal["butt", "projecting", "round"]
83+
"""Line cap styles. See :doc:`/gallery/lines_bars_and_markers/capstyle`."""
5884

5985
CoordsBaseType = Union[
6086
str,

0 commit comments

Comments
 (0)