From b616b160e727699b820be36ca1c5c8430aee71ad Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 16 Feb 2019 20:51:14 +0100 Subject: [PATCH] Update axes_grid docs --- lib/mpl_toolkits/axes_grid1/axes_grid.py | 98 ++++++++++++++++-------- 1 file changed, 64 insertions(+), 34 deletions(-) diff --git a/lib/mpl_toolkits/axes_grid1/axes_grid.py b/lib/mpl_toolkits/axes_grid1/axes_grid.py index ce4673638e50..2fcad75cefaa 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_grid.py +++ b/lib/mpl_toolkits/axes_grid1/axes_grid.py @@ -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) @@ -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 @@ -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 @@ -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) @@ -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