5
5
Customizing Location of Subplot Using GridSpec
6
6
**********************************************
7
7
8
- `` GridSpec ` `
8
+ :class: ` ~matplotlib.gridspec. GridSpec `
9
9
specifies the geometry of the grid that a subplot will be
10
10
placed. The number of rows and number of columns of the grid
11
11
need to be set. Optionally, the subplot layout parameters
12
12
(e.g., left, right, etc.) can be tuned.
13
13
14
- `` SubplotSpec ` `
14
+ :class: ` ~matplotlib.gridspec. SubplotSpec `
15
15
specifies the location of the subplot in the given *GridSpec *.
16
16
17
- `` subplot2grid ` `
18
- a helper function that is similar to " pyplot.subplot" but uses
19
- 0-based indexing and let subplot to occupy multiple cells.
17
+ :func: ` ~matplotlib.pyplot. subplot2grid `
18
+ a helper function that is similar to :func: ` ~matplotlib. pyplot.subplot`
19
+ but uses 0-based indexing and let subplot to occupy multiple cells.
20
20
21
21
22
22
Basic Example of using subplot2grid
23
23
===================================
24
24
25
- To use subplot2grid, you provide geometry of the grid and the location
26
- of the subplot in the grid. For a simple single-cell subplot::
25
+ To use :func: `~matplotlib.pyplot.subplot2grid `, you provide geometry of
26
+ the grid and the location of the subplot in the grid. For a simple
27
+ single-cell subplot::
27
28
28
29
ax = plt.subplot2grid((2, 2), (0, 0))
29
30
30
31
is identical to ::
31
32
32
33
ax = plt.subplot(2, 2, 1)
33
34
34
- Note that, unlike matplotlib 's subplot, the index starts from 0 in GridSpec.
35
+ Note that, unlike Matplotlib 's subplot, the index starts from 0 in GridSpec.
35
36
36
37
To create a subplot that spans multiple cells, ::
37
38
@@ -54,11 +55,12 @@ creates
54
55
GridSpec and SubplotSpec
55
56
========================
56
57
57
- You can create GridSpec explicitly and use them to create a Subplot.
58
+ You can create :class: `~matplotlib.gridspec.GridSpec ` explicitly and use
59
+ them to create a subplot.
58
60
59
61
For example, ::
60
62
61
- ax = plt.subplot2grid((2, 2),(0, 0))
63
+ ax = plt.subplot2grid((2, 2), (0, 0))
62
64
63
65
is equal to ::
64
66
@@ -67,7 +69,7 @@ is equal to ::
67
69
ax = plt.subplot(gs[0, 0])
68
70
69
71
A GridSpec instance provides array-like (2d or 1d) indexing that
70
- returns the SubplotSpec instance. For, SubplotSpec that spans multiple
72
+ returns the SubplotSpec instance. For a SubplotSpec that spans multiple
71
73
cells, use slice. ::
72
74
73
75
ax2 = plt.subplot(gs[1, :-1])
@@ -93,8 +95,8 @@ parameters of subplots that are created from the GridSpec. ::
93
95
gs1 = gridspec.GridSpec(3, 3)
94
96
gs1.update(left=0.05, right=0.48, wspace=0.05)
95
97
96
- This is similar to * subplots_adjust * , but it only affects the subplots
97
- that are created from the given GridSpec.
98
+ This is similar to :func: ` ~matplotlib.pyplot. subplots_adjust` , but it only
99
+ affects the subplots that are created from the given GridSpec.
98
100
99
101
The code below ::
100
102
@@ -117,8 +119,9 @@ creates
117
119
GridSpec using SubplotSpec
118
120
==========================
119
121
120
- You can create GridSpec from the SubplotSpec, in which case its layout
121
- parameters are set to that of the location of the given SubplotSpec. ::
122
+ You can create GridSpec from the :class: `~matplotlib.gridspec.SubplotSpec `,
123
+ in which case its layout parameters are set to that of the location of
124
+ the given SubplotSpec. ::
122
125
123
126
gs0 = gridspec.GridSpec(1, 2)
124
127
0 commit comments