Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve mpl_toolkit documentation #23536

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
Oct 21, 2022
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
48 changes: 24 additions & 24 deletions lib/mpl_toolkits/axes_grid1/anchored_artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, width, height, xdescent, ydescent,
loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
**kwargs):
"""
An anchored container with a fixed size and fillable DrawingArea.
An anchored container with a fixed size and fillable `.DrawingArea`.

Artists added to the *drawing_area* will have their coordinates
interpreted as pixels. Any transformations set on the artists will be
Expand All @@ -37,16 +37,16 @@ def __init__(self, width, height, xdescent, ydescent,
Padding around the child objects, in fraction of the font size.
borderpad : float, default: 0.5
Border padding, in fraction of the font size.
prop : `matplotlib.font_manager.FontProperties`, optional
prop : `~matplotlib.font_manager.FontProperties`, optional
Font property used as a reference for paddings.
frameon : bool, default: True
If True, draw a box around this artists.
If True, draw a box around this artist.
**kwargs
Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
drawing_area : `matplotlib.offsetbox.DrawingArea`
drawing_area : `~matplotlib.offsetbox.DrawingArea`
A container for artists to display.

Examples
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, transform, loc,

Parameters
----------
transform : `matplotlib.transforms.Transform`
transform : `~matplotlib.transforms.Transform`
The transformation object for the coordinate system in use, i.e.,
:attr:`matplotlib.axes.Axes.transData`.
loc : str
Expand All @@ -95,16 +95,16 @@ def __init__(self, transform, loc,
Padding around the child objects, in fraction of the font size.
borderpad : float, default: 0.5
Border padding, in fraction of the font size.
prop : `matplotlib.font_manager.FontProperties`, optional
prop : `~matplotlib.font_manager.FontProperties`, optional
Font property used as a reference for paddings.
frameon : bool, default: True
If True, draw a box around this artists.
If True, draw a box around this artist.
**kwargs
Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
drawing_area : `matplotlib.offsetbox.AuxTransformBox`
drawing_area : `~matplotlib.offsetbox.AuxTransformBox`
A container for artists to display.

Examples
Expand Down Expand Up @@ -132,7 +132,7 @@ def __init__(self, transform, width, height, angle, loc,

Parameters
----------
transform : `matplotlib.transforms.Transform`
transform : `~matplotlib.transforms.Transform`
The transformation object for the coordinate system in use, i.e.,
:attr:`matplotlib.axes.Axes.transData`.
width, height : float
Expand All @@ -153,14 +153,14 @@ def __init__(self, transform, width, height, angle, loc,
Border padding, in fraction of the font size.
frameon : bool, default: True
If True, draw a box around the ellipse.
prop : `matplotlib.font_manager.FontProperties`, optional
prop : `~matplotlib.font_manager.FontProperties`, optional
Font property used as a reference for paddings.
**kwargs
Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
ellipse : `matplotlib.patches.Ellipse`
ellipse : `~matplotlib.patches.Ellipse`
Ellipse patch drawn.
"""
self._box = AuxTransformBox(transform)
Expand All @@ -182,7 +182,7 @@ def __init__(self, transform, size, label, loc,

Parameters
----------
transform : `matplotlib.transforms.Transform`
transform : `~matplotlib.transforms.Transform`
The transformation object for the coordinate system in use, i.e.,
:attr:`matplotlib.axes.Axes.transData`.
size : float
Expand Down Expand Up @@ -213,7 +213,7 @@ def __init__(self, transform, size, label, loc,
Color for the size bar and label.
label_top : bool, default: False
If True, the label will be over the size bar.
fontproperties : `matplotlib.font_manager.FontProperties`, optional
fontproperties : `~matplotlib.font_manager.FontProperties`, optional
Font properties for the label text.
fill_bar : bool, optional
If True and if *size_vertical* is nonzero, the size bar will
Expand All @@ -225,15 +225,15 @@ def __init__(self, transform, size, label, loc,

Attributes
----------
size_bar : `matplotlib.offsetbox.AuxTransformBox`
size_bar : `~matplotlib.offsetbox.AuxTransformBox`
Container for the size bar.
txt_label : `matplotlib.offsetbox.TextArea`
txt_label : `~matplotlib.offsetbox.TextArea`
Container for the label of the size bar.

Notes
-----
If *prop* is passed as a keyword argument, but *fontproperties* is
not, then *prop* is be assumed to be the intended *fontproperties*.
not, then *prop* is assumed to be the intended *fontproperties*.
Using both *prop* and *fontproperties* is not supported.

Examples
Expand Down Expand Up @@ -301,7 +301,7 @@ def __init__(self, transform, label_x, label_y, length=0.15,

Parameters
----------
transform : `matplotlib.transforms.Transform`
transform : `~matplotlib.transforms.Transform`
The transformation object for the coordinate system in use, i.e.,
:attr:`matplotlib.axes.Axes.transAxes`.
label_x, label_y : str
Expand Down Expand Up @@ -335,7 +335,7 @@ def __init__(self, transform, label_x, label_y, length=0.15,
sep_x, sep_y : float, default: 0.01 and 0 respectively
Separation between the arrows and labels in coordinates of
*transform*.
fontproperties : `matplotlib.font_manager.FontProperties`, optional
fontproperties : `~matplotlib.font_manager.FontProperties`, optional
Font properties for the label text.
back_length : float, default: 0.15
Fraction of the arrow behind the arrow crossing.
Expand All @@ -347,25 +347,25 @@ def __init__(self, transform, label_x, label_y, length=0.15,
Width of arrow tail, sent to ArrowStyle.
text_props, arrow_props : dict
Properties of the text and arrows, passed to
`.textpath.TextPath` and `.patches.FancyArrowPatch`.
`~.textpath.TextPath` and `~.patches.FancyArrowPatch`.
**kwargs
Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
arrow_x, arrow_y : `matplotlib.patches.FancyArrowPatch`
arrow_x, arrow_y : `~matplotlib.patches.FancyArrowPatch`
Arrow x and y
text_path_x, text_path_y : `matplotlib.textpath.TextPath`
text_path_x, text_path_y : `~matplotlib.textpath.TextPath`
Path for arrow labels
p_x, p_y : `matplotlib.patches.PathPatch`
p_x, p_y : `~matplotlib.patches.PathPatch`
Patch for arrow labels
box : `matplotlib.offsetbox.AuxTransformBox`
box : `~matplotlib.offsetbox.AuxTransformBox`
Container for the arrows and labels.

Notes
-----
If *prop* is passed as a keyword argument, but *fontproperties* is
not, then *prop* is be assumed to be the intended *fontproperties*.
not, then *prop* is assumed to be the intended *fontproperties*.
Using both *prop* and *fontproperties* is not supported.

Examples
Expand Down
30 changes: 15 additions & 15 deletions lib/mpl_toolkits/axes_grid1/axes_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):

def new_locator(self, nx, ny, nx1=None, ny1=None):
"""
Return a new `AxesLocator` for the specified cell.
Return a new `.AxesLocator` for the specified cell.

Parameters
----------
nx, nx1 : int
Integers specifying the column-position of the
cell. When *nx1* is None, a single *nx*-th column is
specified. Otherwise location of columns spanning between *nx*
specified. Otherwise, location of columns spanning between *nx*
to *nx1* (but excluding *nx1*-th column) is specified.
ny, ny1 : int
Same as *nx* and *nx1*, but for row positions.
Expand Down Expand Up @@ -274,7 +274,7 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):

Parameters
----------
use_axes : `~.axes.Axes` or list of `~.axes.Axes`
use_axes : `~matplotlib.axes.Axes` or list of `~matplotlib.axes.Axes`
The Axes whose decorations are taken into account.
pad : float, optional
Additional padding in inches.
Expand All @@ -290,18 +290,18 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
class AxesLocator:
"""
A callable object which returns the position and size of a given
AxesDivider cell.
`.AxesDivider` cell.
"""

def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
"""
Parameters
----------
axes_divider : AxesDivider
axes_divider : `~mpl_toolkits.axes_grid1.axes_divider.AxesDivider`
nx, nx1 : int
Integers specifying the column-position of the
cell. When *nx1* is None, a single *nx*-th column is
specified. Otherwise location of columns spanning between *nx*
specified. Otherwise, location of columns spanning between *nx*
to *nx1* (but excluding *nx1*-th column) is specified.
ny, ny1 : int
Same as *nx* and *nx1*, but for row positions.
Expand Down Expand Up @@ -355,7 +355,7 @@ def __init__(self, fig, *args, horizontal=None, vertical=None,
"""
Parameters
----------
fig : `matplotlib.figure.Figure`
fig : `~matplotlib.figure.Figure`

*args : tuple (*nrows*, *ncols*, *index*) or int
The array of subplots in the figure has dimensions ``(nrows,
Expand Down Expand Up @@ -601,7 +601,7 @@ def _locate(x, y, w, h, summed_widths, equal_heights, fig_w, fig_h, anchor):

class HBoxDivider(SubplotDivider):
"""
A `SubplotDivider` for laying out axes horizontally, while ensuring that
A `.SubplotDivider` for laying out axes horizontally, while ensuring that
they have equal heights.

Examples
Expand All @@ -611,14 +611,14 @@ class HBoxDivider(SubplotDivider):

def new_locator(self, nx, nx1=None):
"""
Create a new `AxesLocator` for the specified cell.
Create a new `.AxesLocator` for the specified cell.

Parameters
----------
nx, nx1 : int
Integers specifying the column-position of the
cell. When *nx1* is None, a single *nx*-th column is
specified. Otherwise location of columns spanning between *nx*
specified. Otherwise, location of columns spanning between *nx*
to *nx1* (but excluding *nx1*-th column) is specified.
"""
return AxesLocator(self, nx, 0, nx1 if nx1 is not None else nx + 1, 1)
Expand All @@ -644,20 +644,20 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):

class VBoxDivider(SubplotDivider):
"""
A `SubplotDivider` for laying out axes vertically, while ensuring that they
have equal widths.
A `.SubplotDivider` for laying out axes vertically, while ensuring that
they have equal widths.
"""

def new_locator(self, ny, ny1=None):
"""
Create a new `AxesLocator` for the specified cell.
Create a new `.AxesLocator` for the specified cell.

Parameters
----------
ny, ny1 : int
Integers specifying the row-position of the
cell. When *ny1* is None, a single *ny*-th row is
specified. Otherwise location of rows spanning between *ny*
specified. Otherwise, location of rows spanning between *ny*
to *ny1* (but excluding *ny1*-th row) is specified.
"""
return AxesLocator(self, 0, ny, 1, ny1 if ny1 is not None else ny + 1)
Expand Down Expand Up @@ -694,7 +694,7 @@ def make_axes_area_auto_adjustable(
"""
Add auto-adjustable padding around *ax* to take its decorations (title,
labels, ticks, ticklabels) into account during layout, using
`Divider.add_auto_adjustable_area`.
`.Divider.add_auto_adjustable_area`.

By default, padding is determined from the decorations of *ax*.
Pass *use_axes* to consider the decorations of other Axes instead.
Expand Down
44 changes: 26 additions & 18 deletions lib/mpl_toolkits/axes_grid1/axes_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):
"""
Parameters
----------
pad : float
Fraction of the axes height.
ax : `~matplotlib.axes.Axes`
Axes instance to create the RGB Axes in.
pad : float, optional
Fraction of the Axes height to pad.
axes_class : `matplotlib.axes.Axes` or None, optional
Axes class to use for the R, G, and B Axes. If None, use
the same class as *ax*.
**kwargs :
Forwarded to *axes_class* init for the R, G, and B Axes.
"""

divider = make_axes_locatable(ax)
Expand Down Expand Up @@ -52,7 +59,7 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):

class RGBAxes:
"""
4-panel imshow (RGB, R, G, B).
4-panel `~.Axes.imshow` (RGB, R, G, B).

Layout:

Expand All @@ -65,17 +72,18 @@ class RGBAxes:
+---------------+-----+

Subclasses can override the ``_defaultAxesClass`` attribute.
By default RGBAxes uses `.mpl_axes.Axes`.

Attributes
----------
RGB : ``_defaultAxesClass``
The axes object for the three-channel imshow.
The Axes object for the three-channel `~.Axes.imshow`.
R : ``_defaultAxesClass``
The axes object for the red channel imshow.
The Axes object for the red channel `~.Axes.imshow`.
G : ``_defaultAxesClass``
The axes object for the green channel imshow.
The Axes object for the green channel `~.Axes.imshow`.
B : ``_defaultAxesClass``
The axes object for the blue channel imshow.
The Axes object for the blue channel `~.Axes.imshow`.
"""

_defaultAxesClass = Axes
Expand All @@ -85,13 +93,13 @@ def __init__(self, *args, pad=0, **kwargs):
Parameters
----------
pad : float, default: 0
fraction of the axes height to put as padding.
axes_class : matplotlib.axes.Axes

Fraction of the Axes height to put as padding.
axes_class : `~matplotlib.axes.Axes`
Axes class to use. If not provided, ``_defaultAxesClass`` is used.
*args
Unpacked into axes_class() init for RGB
Forwarded to *axes_class* init for the RGB Axes
**kwargs
Unpacked into axes_class() init for RGB, R, G, B axes
Forwarded to *axes_class* init for the RGB, R, G, and B Axes
"""
axes_class = kwargs.pop("axes_class", self._defaultAxesClass)
self.RGB = ax = axes_class(*args, **kwargs)
Expand All @@ -111,15 +119,15 @@ def imshow_rgb(self, r, g, b, **kwargs):
----------
r, g, b : array-like
The red, green, and blue arrays.
kwargs : imshow kwargs
kwargs get unpacked into the imshow calls for the four images.
**kwargs :
Forwarded to `~.Axes.imshow` calls for the four images.

Returns
-------
rgb : matplotlib.image.AxesImage
r : matplotlib.image.AxesImage
g : matplotlib.image.AxesImage
b : matplotlib.image.AxesImage
rgb : `~matplotlib.image.AxesImage`
r : `~matplotlib.image.AxesImage`
g : `~matplotlib.image.AxesImage`
b : `~matplotlib.image.AxesImage`
"""
if not (r.shape == g.shape == b.shape):
raise ValueError(
Expand Down
Loading