Skip to content

Commit 2767683

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

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-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

+28-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
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::
8+
**Provisional status of typing**
89
910
The ``typing`` module and type stub files are considered provisional and may change
1011
at any time without a deprecation period.
@@ -21,6 +22,8 @@
2122
from .transforms import Bbox, Transform
2223

2324
RGBColorType: TypeAlias = tuple[float, float, float] | str
25+
"""Any RGB color specification accepted by Matplotlib."""
26+
2427
RGBAColorType: TypeAlias = (
2528
str | # "none" or "#RRGGBBAA"/"#RGBA" hex strings
2629
tuple[float, float, float, float] |
@@ -30,31 +33,55 @@
3033
# (4-tuple, float) is odd, but accepted as the outer float overriding A of 4-tuple
3134
tuple[tuple[float, float, float, float], float]
3235
)
36+
"""Any RGBA color specification accepted by Matplotlib."""
3337

3438
ColorType: TypeAlias = RGBColorType | RGBAColorType
39+
"""Any color specification accepted by Matplotlib. See :mpltype:`color`."""
3540

3641
RGBColourType: TypeAlias = RGBColorType
42+
"""Alias of `.RGBColorType`."""
43+
3744
RGBAColourType: TypeAlias = RGBAColorType
45+
"""Alias of `.RGBAColorType`."""
46+
3847
ColourType: TypeAlias = ColorType
48+
"""Alias of `.ColorType`."""
3949

4050
LineStyleType: TypeAlias = (
4151
Literal["-", "solid", "--", "dashed", "-.", "dashdot", ":", "dotted",
4252
"", "none", " ", "None"] |
4353
tuple[float, Sequence[float]]
4454
)
55+
"""
56+
Any line style specification accepted by Matplotlib.
57+
See :doc:`/gallery/lines_bars_and_markers/linestyles`.
58+
"""
59+
4560
DrawStyleType: TypeAlias = Literal["default", "steps", "steps-pre", "steps-mid",
4661
"steps-post"]
62+
"""See :doc:`/gallery/lines_bars_and_markers/step_demo`."""
63+
4764
MarkEveryType: TypeAlias = (
4865
None |
4966
int | tuple[int, int] | slice | list[int] |
5067
float | tuple[float, float] |
5168
list[bool]
5269
)
70+
"""See :doc:`/gallery/lines_bars_and_markers/markevery_demo`."""
5371

5472
MarkerType: TypeAlias = str | path.Path | MarkerStyle
73+
"""
74+
Marker specification. See :doc:`/gallery/lines_bars_and_markers/marker_reference`.
75+
"""
76+
5577
FillStyleType: TypeAlias = Literal["full", "left", "right", "bottom", "top", "none"]
78+
"""Marker fill styles. See :doc:`/gallery/lines_bars_and_markers/marker_reference`."""
79+
5680
JoinStyleType: TypeAlias = JoinStyle | Literal["miter", "round", "bevel"]
81+
"""Line join styles. See :doc:`/gallery/lines_bars_and_markers/joinstyle`."""
82+
5783
CapStyleType: TypeAlias = CapStyle | Literal["butt", "projecting", "round"]
84+
"""Line cap styles. See :doc:`/gallery/lines_bars_and_markers/capstyle`."""
5885

5986
CoordsBaseType = Union[
6087
str,

0 commit comments

Comments
 (0)