Skip to content

[Doc] Improve documentation types #26186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def contains(self, mouseevent):

Parameters
----------
mouseevent : `matplotlib.backend_bases.MouseEvent`
mouseevent : `~matplotlib.backend_bases.MouseEvent`

Returns
-------
Expand Down Expand Up @@ -774,7 +774,7 @@ def set_clip_path(self, path, transform=None):

Parameters
----------
path : `.Patch` or `.Path` or `.TransformedPath` or None
path : `~matplotlib.patches.Patch` or `.Path` or `.TransformedPath` or None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this one can be even better, but so far I'm down the search and replace route.

The clip path. If given a `.Path`, *transform* must be provided as
well. If *None*, a previously set clip path is removed.
transform : `~matplotlib.transforms.Transform`, optional
Expand Down Expand Up @@ -1300,7 +1300,7 @@ def get_cursor_data(self, event):

Parameters
----------
event : `matplotlib.backend_bases.MouseEvent`
event : `~matplotlib.backend_bases.MouseEvent`

See Also
--------
Expand Down Expand Up @@ -1714,7 +1714,7 @@ def getp(obj, property=None):

Parameters
----------
obj : `.Artist`
obj : `~matplotlib.artist.Artist`
The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`.

property : str or None, default: None
Expand Down Expand Up @@ -1753,7 +1753,7 @@ def setp(obj, *args, file=None, **kwargs):

Parameters
----------
obj : `.Artist` or list of `.Artist`
obj : `~matplotlib.artist.Artist` or list of `.Artist`
The artist(s) whose properties are being set or queried. When setting
properties, all artists are affected; when querying the allowed values,
only the first instance in the sequence is queried.
Expand Down
20 changes: 11 additions & 9 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None,

Other Parameters
----------------
**kwargs : `.Text` properties
**kwargs : `~matplotlib.text.Text` properties
Other keyword arguments are text properties, see `.Text` for a list
of valid text properties.
"""
Expand Down Expand Up @@ -1609,7 +1609,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
data limits. The values are passed on to
`~.axes.Axes.autoscale_view`.

**kwargs : `.Line2D` properties, optional
**kwargs : `~matplotlib.lines.Line2D` properties, optional
*kwargs* are used to specify properties like a line label (for
auto legends), linewidth, antialiasing, marker face color.
Example::
Expand Down Expand Up @@ -2001,13 +2001,13 @@ def acorr(self, x, **kwargs):

- `.LineCollection` if *usevlines* is True.
- `.Line2D` if *usevlines* is False.
b : `.Line2D` or None
b : `~matplotlib.lines.Line2D` or None
Horizontal line at 0 if *usevlines* is True
None *usevlines* is False.

Other Parameters
----------------
linestyle : `.Line2D` property, optional
linestyle : `~matplotlib.lines.Line2D` property, optional
The linestyle for plotting the data points.
Only used if *usevlines* is ``False``.

Expand Down Expand Up @@ -2078,13 +2078,13 @@ def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,

- `.LineCollection` if *usevlines* is True.
- `.Line2D` if *usevlines* is False.
b : `.Line2D` or None
b : `~matplotlib.lines.Line2D` or None
Horizontal line at 0 if *usevlines* is True
None *usevlines* is False.

Other Parameters
----------------
linestyle : `.Line2D` property, optional
linestyle : `~matplotlib.lines.Line2D` property, optional
The linestyle for plotting the data points.
Only used if *usevlines* is ``False``.

Expand Down Expand Up @@ -3465,8 +3465,10 @@ def errorbar(self, x, y, yerr=None, xerr=None,
`.ErrorbarContainer`
The container contains:

- plotline: `.Line2D` instance of x, y plot markers and/or line.
- caplines: A tuple of `.Line2D` instances of the error bar caps.
- plotline: `~matplotlib.lines.Line2D` instance of x, y plot markers
and/or line.
- caplines: A tuple of `~matplotlib.lines.Line2D` instances of the error
bar caps.
- barlinecols: A tuple of `.LineCollection` with the horizontal and
vertical error ranges.

Expand Down Expand Up @@ -7051,7 +7053,7 @@ def stairs(self, values, edges=None, *,

Returns
-------
StepPatch : `matplotlib.patches.StepPatch`
StepPatch : `~matplotlib.patches.StepPatch`

Other Parameters
----------------
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def __init__(self, fig,
being created. Finally, ``*args`` can also directly be a
`.SubplotSpec` instance.

sharex, sharey : `~.axes.Axes`, optional
sharex, sharey : `~matplotlib.axes.Axes`, optional
The x- or y-`~.matplotlib.axis` is shared with the x- or y-axis in
the input `~.axes.Axes`.

Expand Down Expand Up @@ -3165,7 +3165,7 @@ def grid(self, visible=None, which='major', axis='both', **kwargs):
axis : {'both', 'x', 'y'}, optional
The axis to apply the changes on.

**kwargs : `.Line2D` properties
**kwargs : `~matplotlib.lines.Line2D` properties
Define the line properties of the grid, e.g.::

grid(color='r', linestyle='-', linewidth=2)
Expand Down Expand Up @@ -3433,7 +3433,7 @@ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, *,

Other Parameters
----------------
**kwargs : `.Text` properties
**kwargs : `~matplotlib.text.Text` properties
`.Text` properties control the appearance of the label.

See Also
Expand Down Expand Up @@ -3681,7 +3681,7 @@ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, *,

Other Parameters
----------------
**kwargs : `.Text` properties
**kwargs : `~matplotlib.text.Text` properties
`.Text` properties control the appearance of the label.

See Also
Expand Down
30 changes: 15 additions & 15 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class Tick(martist.Artist):

Attributes
----------
tick1line : `.Line2D`
tick1line : `~matplotlib.lines.Line2D`
The left/bottom tick marker.
tick2line : `.Line2D`
tick2line : `~matplotlib.lines.Line2D`
The right/top tick marker.
gridline : `.Line2D`
gridline : `~matplotlib.lines.Line2D`
The grid line associated with the label position.
label1 : `.Text`
label1 : `~matplotlib.text.Text`
The left/bottom tick label.
label2 : `.Text`
label2 : `~matplotlib.text.Text`
The right/top tick label.

"""
Expand Down Expand Up @@ -526,9 +526,9 @@ class Ticker:

Attributes
----------
locator : `matplotlib.ticker.Locator` subclass
locator : `~matplotlib.ticker.Locator` subclass
Determines the positions of the ticks.
formatter : `matplotlib.ticker.Formatter` subclass
formatter : `~matplotlib.ticker.Formatter` subclass
Determines the format of the tick labels.
"""

Expand Down Expand Up @@ -601,20 +601,20 @@ class Axis(martist.Artist):
----------
isDefault_label : bool

axes : `matplotlib.axes.Axes`
axes : `~matplotlib.axes.Axes`
The `~.axes.Axes` to which the Axis belongs.
major : `matplotlib.axis.Ticker`
major : `~matplotlib.axis.Ticker`
Determines the major tick positions and their label format.
minor : `matplotlib.axis.Ticker`
minor : `~matplotlib.axis.Ticker`
Determines the minor tick positions and their label format.
callbacks : `matplotlib.cbook.CallbackRegistry`
callbacks : `~matplotlib.cbook.CallbackRegistry`

label : `.Text`
label : `~matplotlib.text.Text`
The axis label.
labelpad : float
The distance between the axis label and the tick labels.
Defaults to :rc:`axes.labelpad` = 4.
offsetText : `.Text`
offsetText : `~matplotlib.text.Text`
A `.Text` object containing the data offset of the ticks (if any).
pickradius : float
The acceptance radius for containment tests. See also `.Axis.contains`.
Expand All @@ -636,7 +636,7 @@ def __init__(self, axes, *, pickradius=15):
"""
Parameters
----------
axes : `matplotlib.axes.Axes`
axes : `~matplotlib.axes.Axes`
The `~.axes.Axes` to which the created Axis belongs.
pickradius : float
The acceptance radius for containment tests. See also
Expand Down Expand Up @@ -1621,7 +1621,7 @@ def grid(self, visible=None, which='major', **kwargs):
which : {'major', 'minor', 'both'}
The grid lines to apply the changes on.

**kwargs : `.Line2D` properties
**kwargs : `~matplotlib.lines.Line2D` properties
Define the line properties of the grid, e.g.::

grid(color='r', linestyle='-', linewidth=2)
Expand Down
18 changes: 9 additions & 9 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ def draw_markers(self, gc, marker_path, marker_trans, path,
----------
gc : `.GraphicsContextBase`
The graphics context.
marker_trans : `matplotlib.transforms.Transform`
marker_trans : `~matplotlib.transforms.Transform`
An affine transform applied to the marker.
trans : `matplotlib.transforms.Transform`
trans : `~matplotlib.transforms.Transform`
An affine transform applied to the path.
"""
for vertices, codes in path.iter_segments(trans, simplify=False):
Expand Down Expand Up @@ -301,7 +301,7 @@ def draw_gouraud_triangle(self, gc, points, colors, transform):
Array of (x, y) points for the triangle.
colors : (3, 4) array-like
RGBA colors for each point of the triangle.
transform : `matplotlib.transforms.Transform`
transform : `~matplotlib.transforms.Transform`
An affine transform to apply to the points.
"""
raise NotImplementedError
Expand All @@ -319,7 +319,7 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
Array of *N* (x, y) points for the triangles.
colors_array : (N, 3, 4) array-like
Array of *N* RGBA colors for each point of the triangles.
transform : `matplotlib.transforms.Transform`
transform : `~matplotlib.transforms.Transform`
An affine transform to apply to the points.
"""
raise NotImplementedError
Expand Down Expand Up @@ -523,7 +523,7 @@ def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
The font properties.
angle : float
The rotation angle in degrees anti-clockwise.
mtext : `matplotlib.text.Text`
mtext : `~matplotlib.text.Text`
The original text object to be rendered.
"""
self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")
Expand All @@ -548,7 +548,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
The rotation angle in degrees anti-clockwise.
ismath : bool or "TeX"
If True, use mathtext parser. If "TeX", use tex for rendering.
mtext : `matplotlib.text.Text`
mtext : `~matplotlib.text.Text`
The original text object to be rendered.

Notes
Expand Down Expand Up @@ -1342,7 +1342,7 @@ class LocationEvent(Event):
----------
x, y : int or None
Event location in pixels from bottom left of canvas.
inaxes : `~.axes.Axes` or None
inaxes : `~matplotlib.axes.Axes` or None
The `~.axes.Axes` instance over which the mouse is, if any.
xdata, ydata : float or None
Data coordinates of the mouse within *inaxes*, or *None* if the mouse
Expand Down Expand Up @@ -1491,7 +1491,7 @@ class PickEvent(Event):
----------
mouseevent : `MouseEvent`
The mouse event that generated the pick.
artist : `matplotlib.artist.Artist`
artist : `~matplotlib.artist.Artist`
The picked artist. Note that artists are not pickable by default
(see `.Artist.set_picker`).
other
Expand Down Expand Up @@ -1669,7 +1669,7 @@ class FigureCanvasBase:

Attributes
----------
figure : `matplotlib.figure.Figure`
figure : `~matplotlib.figure.Figure`
A high-level figure instance.
"""

Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/backends/backend_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
"""
Parameters
----------
figure : `matplotlib.figure.Figure`
figure : `~matplotlib.figure.Figure`
The figure instance.
width : scalar
The width of the canvas in logical units
height : scalar
The height of the canvas in logical units
dpi : float
The dpi of the canvas
vector_renderer : `matplotlib.backend_bases.RendererBase`
vector_renderer : `~matplotlib.backend_bases.RendererBase`
An instance of a subclass of
`~matplotlib.backend_bases.RendererBase` that will be used for the
vector drawing.
raster_renderer_class : `matplotlib.backend_bases.RendererBase`
raster_renderer_class : `~matplotlib.backend_bases.RendererBase`
The renderer class to use for the raster drawing. If not provided,
this will use the Agg backend (which is currently the only viable
option anyway.)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def __init__(self, figure, fh):

Attributes
----------
figure : `matplotlib.figure.Figure`
figure : `~matplotlib.figure.Figure`
Matplotlib figure to initialize height, width and dpi from.
fh : file-like
File handle for the output of the drawing commands.
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class methods button_press_event, button_release_event,

Attributes
----------
figure : `matplotlib.figure.Figure`
figure : `~matplotlib.figure.Figure`
A high-level Figure instance
"""

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _get_cmap(name=None, lut=None):

Parameters
----------
name : `matplotlib.colors.Colormap` or str or None, default: None
name : `~matplotlib.colors.Colormap` or str or None, default: None
If a `.Colormap` instance, it will be returned. Otherwise, the name of
a colormap known to Matplotlib, which will be resampled by *lut*. The
default, None, means :rc:`image.cmap`.
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,13 +1380,13 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
Parameters
----------
parents : `~.axes.Axes` or iterable or `numpy.ndarray` of `~.axes.Axes`
parents : `~matplotlib.axes.Axes` or iterable or `numpy.ndarray` of `~.axes.Axes`
The Axes to use as parents for placing the colorbar.
%(_make_axes_kw_doc)s
Returns
-------
cax : `~.axes.Axes`
cax : `~matplotlib.axes.Axes`
The child axes.
kwargs : dict
The reduced keyword dictionary to be passed when creating the colorbar
Expand Down Expand Up @@ -1494,13 +1494,13 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
Parameters
----------
parent : `~.axes.Axes`
parent : `~matplotlib.axes.Axes`
The Axes to use as parent for placing the colorbar.
%(_make_axes_kw_doc)s
Returns
-------
cax : `~.axes.Axes`
cax : `~matplotlib.axes.Axes`
The child axes.
kwargs : dict
The reduced keyword dictionary to be passed when creating the colorbar
Expand Down
Loading