Skip to content

Commit 9b2320e

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

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

doc/api/typing_api.rst

Lines changed: 19 additions & 4 deletions
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

Lines changed: 22 additions & 1 deletion
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,8 +32,10 @@
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
3741
RGBAColourType: TypeAlias = RGBAColorType
@@ -42,19 +46,36 @@
4246
"", "none", " ", "None"] |
4347
tuple[float, Sequence[float]]
4448
)
49+
"""
50+
Any line style specification accepted by Matplotlib.
51+
See :doc:`/gallery/lines_bars_and_markers/linestyles`.
52+
"""
53+
4554
DrawStyleType: TypeAlias = Literal["default", "steps", "steps-pre", "steps-mid",
4655
"steps-post"]
56+
"""See :doc:`/gallery/lines_bars_and_markers/step_demo`."""
57+
4758
MarkEveryType: TypeAlias = (
4859
None |
4960
int | tuple[int, int] | slice | list[int] |
5061
float | tuple[float, float] |
5162
list[bool]
5263
)
64+
"""See :doc:`/gallery/lines_bars_and_markers/markevery_demo`."""
5365

5466
MarkerType: TypeAlias = str | path.Path | MarkerStyle
67+
"""
68+
Marker specification. See :doc:`/gallery/lines_bars_and_markers/marker_reference`.
69+
"""
70+
5571
FillStyleType: TypeAlias = Literal["full", "left", "right", "bottom", "top", "none"]
72+
"""Marker fill styles. See :doc:`/gallery/lines_bars_and_markers/marker_reference`."""
73+
5674
JoinStyleType: TypeAlias = JoinStyle | Literal["miter", "round", "bevel"]
75+
"""Line join styles. See :doc:`/gallery/lines_bars_and_markers/joinstyle`."""
76+
5777
CapStyleType: TypeAlias = CapStyle | Literal["butt", "projecting", "round"]
78+
"""Line cap styles. See :doc:`/gallery/lines_bars_and_markers/capstyle`."""
5879

5980
CoordsBaseType = Union[
6081
str,

0 commit comments

Comments
 (0)