@@ -82,12 +82,13 @@ def cla(self):
82
82
83
83
class Grid :
84
84
"""
85
- A class that creates a grid of Axes. In matplotlib, the axes
86
- location (and size) is specified in the normalized figure
87
- coordinates. This may not be ideal for images that needs to be
88
- displayed with a given aspect ratio. For example, displaying
89
- images of a same size with some fixed padding between them cannot
90
- be easily done in matplotlib. AxesGrid is used in such case.
85
+ A grid of Axes.
86
+
87
+ In Matplotlib, the axes location (and size) is specified in normalized
88
+ figure coordinates. This may not be ideal for images that needs to be
89
+ displayed with a given aspect ratio; for example, it is difficult to
90
+ display multiple images of a same size with some fixed padding between
91
+ them. AxesGrid can be used in such case.
91
92
"""
92
93
93
94
_defaultAxesClass = Axes
@@ -115,14 +116,25 @@ def __init__(self, fig,
115
116
rect : (float, float, float, float) or int
116
117
The axes position, as a ``(left, bottom, width, height)`` tuple or
117
118
as a three-digit subplot position code (e.g., "121").
119
+ nrows_ncols : (int, int)
120
+ Number of rows and columns in the grid.
121
+ ngrids : int or None, default: None
122
+ If not None, only the first *ngrids* axes in the grid are created.
118
123
direction : {"row", "column"}, default: "row"
124
+ Whether axes are created in row-major ("row by row") or
125
+ column-major order ("column by column").
119
126
axes_pad : float or (float, float), default: 0.02
120
127
Padding or (horizontal padding, vertical padding) between axes, in
121
128
inches.
122
129
add_all : bool, default: True
130
+ Whether to add the axes to the figure using `.Figure.add_axes`.
123
131
share_all : bool, default: False
132
+ Whether all axes share their x- and y-axis. Overrides *share_x*
133
+ and *share_y*.
124
134
share_x : bool, default: True
135
+ Whether all axes of a column share their x-axis.
125
136
share_y : bool, default: True
137
+ Whether all axes of a row share their y-axis.
126
138
label_mode : {"L", "1", "all"}, default: "L"
127
139
Determines which axes will get tick labels:
128
140
@@ -133,6 +145,8 @@ def __init__(self, fig,
133
145
134
146
axes_class : subclass of `matplotlib.axes.Axes`, default: None
135
147
aspect : bool, default: False
148
+ Whether the axes aspect ratio follows the aspect ratio of the data
149
+ limits.
136
150
"""
137
151
self ._nrows , self ._ncols = nrows_ncols
138
152
@@ -332,14 +346,7 @@ def get_vsize_hsize(self):
332
346
333
347
334
348
class ImageGrid (Grid ):
335
- """
336
- A class that creates a grid of Axes. In matplotlib, the axes
337
- location (and size) is specified in the normalized figure
338
- coordinates. This may not be ideal for images that needs to be
339
- displayed with a given aspect ratio. For example, displaying
340
- images of a same size with some fixed padding between them cannot
341
- be easily done in matplotlib. ImageGrid is used in such case.
342
- """
349
+ # docstring inherited
343
350
344
351
_defaultCbarAxesClass = CbarAxes
345
352
@@ -368,13 +375,24 @@ def __init__(self, fig,
368
375
rect : (float, float, float, float) or int
369
376
The axes position, as a ``(left, bottom, width, height)`` tuple or
370
377
as a three-digit subplot position code (e.g., "121").
378
+ nrows_ncols : (int, int)
379
+ Number of rows and columns in the grid.
380
+ ngrids : int or None, default: None
381
+ If not None, only the first *ngrids* axes in the grid are created.
371
382
direction : {"row", "column"}, default: "row"
372
- axes_pad : float or (float, float), default: 0.02
383
+ Whether axes are created in row-major ("row by row") or
384
+ column-major order ("column by column"). This also affects the
385
+ order in which axes are accessed using indexing (``grid[index]``).
386
+ axes_pad : float or (float, float), default: 0.02in
373
387
Padding or (horizontal padding, vertical padding) between axes, in
374
388
inches.
375
389
add_all : bool, default: True
390
+ Whether to add the axes to the figure using `.Figure.add_axes`.
376
391
share_all : bool, default: False
392
+ Whether all axes share their x- and y-axis.
377
393
aspect : bool, default: True
394
+ Whether the axes aspect ratio follows the aspect ratio of the data
395
+ limits.
378
396
label_mode : {"L", "1", "all"}, default: "L"
379
397
Determines which axes will get tick labels:
380
398
@@ -383,10 +401,16 @@ def __init__(self, fig,
383
401
- "1": Only the bottom left axes is labelled.
384
402
- "all": all axes are labelled.
385
403
386
- cbar_mode : {"each", "single", "edge", None }, default: None
404
+ cbar_mode : {"each", "single", "edge", None}, default: None
405
+ Whether to create a colorbar for "each" axes, a "single" colorbar
406
+ for the entire grid, colorbars only for axes on the "edge"
407
+ determined by *cbar_location*, or no colorbars. The colorbars are
408
+ stored in the :attr:`cbar_axes` attribute.
387
409
cbar_location : {"left", "right", "bottom", "top"}, default: "right"
388
410
cbar_pad : float, default: None
411
+ Padding between the image axes and the colorbar axes.
389
412
cbar_size : size specification (see `.Size.from_any`), default: "5%"
413
+ Colorbar size.
390
414
cbar_set_cax : bool, default: True
391
415
If True, each axes in the grid has a *cax* attribute that is bound
392
416
to associated *cbar_axes*.
0 commit comments