8000 Update axes_grid docs by timhoffm · Pull Request #13447 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Update axes_grid docs #13447

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
Feb 22, 2019
Merged
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
98 changes: 64 additions & 34 deletions lib/mpl_toolkits/axes_grid1/axes_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ def on_changed(m):
return cb

def _config_axes(self):
'''
Make an axes patch and outline.
'''
"""Make an axes patch and outline."""
ax = self
ax.set_navigate(False)

Expand Down Expand Up @@ -142,22 +140,29 @@ def __init__(self, fig,
"""
Parameters
----------
fig : Figure
fig : `.Figure`
The parent figure.
rect : (float, float, float, float) or int
The axes position, as a ``(left, bottom, width, height)`` tuple or
as a three-digit subplot position code (e.g., "121").
direction : {"row", "column"}, defaults to "row"
axes_pad : float or (float, float), defaults to 0.02
direction : {"row", "column"}, default: "row"
axes_pad : float or (float, float), default: 0.02
Padding or (horizontal padding, vertical padding) between axes, in
inches.
add_all : bool, defaults to True
share_all : bool, defaults to False
share_x : bool, defaults to True
share_y : bool, defaults to True
label_mode : {"L", "1", "all"}, defaults to "L"
add_all : bool, default: True
share_all : bool, default: False
share_x : bool, default: True
share_y : bool, default: True
label_mode : {"L", "1", "all"}, default: "L"
Determines which axes will get tick labels:

- "L": All axes on the left column get vertical tick labels;
all axes on the bottom row get horizontal tick labels.
- "1": Only the bottom left axes is labelled.
- "all": all axes are labelled.

axes_class : a type that is a subclass of `matplotlib.axes.Axes`, \
defaults to None
default: None
"""
self._nrows, self._ncols = nrows_ncols

Expand Down Expand Up @@ -320,13 +325,19 @@ def __getitem__(self, i):

def get_geometry(self):
"""
get geometry of the grid. Returns a tuple of two integer,
representing number of rows and number of columns.
Return the number of rows and columns of the grid as (nrows, ncols).
"""
return self._nrows, self._ncols

def set_axes_pad(self, axes_pad):
"set axes_pad"
"""
Set the padding between the axes.

Parameters
----------
axes_pad : (float, float)
The padding (horizontal pad, vertical pad) in inches.
"""
self._axes_pad = axes_pad

# These two lines actually differ from ones in _init_axes_pad
Expand All @@ -335,25 +346,37 @@ def set_axes_pad(self, axes_pad):

def get_axes_pad(self):
"""
get axes_pad
Return the axes padding.

Returns
-------
tuple
Padding in inches, (horizontal pad, vertical pad)
hpad, vpad
Padding (horizontal pad, vertical pad) in inches.
"""
return self._axes_pad

def set_aspect(self, aspect):
"set aspect"
"""Set the aspect of the SubplotDivider."""
self._divider.set_aspect(aspect)

def get_aspect(self):
"get aspect"
"""Return the aspect of the SubplotDivider."""
return self._divider.get_aspect()

def set_label_mode(self, mode):
"set label_mode"
"""
Define which axes have tick labels.

Parameters
----------
mode : {"L", "1", "all"}
The label mode:

- "L": All axes on the left column get vertical tick labels;
all axes on the bottom row get horizontal tick labels.
- "1": Only the bottom left axes is labelled.
- "all": all axes are labelled.
"""
if mode == "all":
for ax in self.axes_all:
_tick_only(ax, False, False)
Expand Down Expand Up @@ -433,28 +456,35 @@ def __init__(self, fig,
"""
Parameters
----------
fig : Figure
fig : `.Figure`
The parent figure.
rect : (float, float, float, float) or int
The axes position, as a ``(left, bottom, width, height)`` tuple or
as a three-digit subplot position code (e.g., "121").
direction : {"row", "column"}, defaults to "row"
axes_pad : float or (float, float), defaults to 0.02
direction : {"row", "column"}, default: "row"
axes_pad : float or (float, float), default: 0.02
Padding or (horizontal padding, vertical padding) between axes, in
inches.
add_all : bool, defaults to True
share_all : bool, defaults to False
aspect : bool, defaults to True
label_mode : {"L", "1", "all"}, defaults to "L"
cbar_mode : {"each", "single", "edge", None }, defaults to None
cbar_location : {"left", "right", "bottom", "top"}, defaults to "right"
cbar_pad : float, defaults to None
cbar_size : size specification (see `.Size.from_any`), defaults to "5%"
cbar_set_cax : bool, defaults to True
add_all : bool, default: True
share_all : bool, default: False
aspect : bool, default: True
label_mode : {"L", "1", "all"}, default: "L"
Determines which axes will get tick labels:

- "L": All axes on the left column get vertical tick labels;
all axes on the bottom row get horizontal tick labels.
- "1": Only the bottom left axes is labelled.
- "all": all axes are labelled.

cbar_mode : {"each", "single", "edge", None }, default: None
cbar_location : {"left", "right", "bottom", "top"}, default: "right"
cbar_pad : float, default: None
cbar_size : size specification (see `.Size.from_any`), default: "5%"
cbar_set_cax : bool, default: True
If True, each axes in the grid has a *cax* attribute that is bound
to associated *cbar_axes*.
axes_class : a type that is a subclass of `matplotlib.axes.Axes`, \
defaults to None
default: None
"""
self._nrows, self._ncols = nrows_ncols

Expand Down
0