Skip to content

Commit e0900e9

Browse files
weiji14seisman
andcommitted
Proofread edits to subplot round 3
Co-Authored-By: Dongdong Tian <seisman.info@gmail.com>
1 parent f4499a8 commit e0900e9

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

examples/tutorials/subplots.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@
207207
fig.basemap(
208208
region=[0, 5, 0, 5], projection="X?", frame=["af", "WSne"], panel=[0, 1]
209209
)
210+
# Move the plot origin upward by 1 cm
211+
fig.shift_origin(yshift="h+1c")
210212
# Top row, one subplot
211-
with fig.subplot(
212-
nrows=1, ncols=1, figsize=("15c", "3c"), autolabel="a)", yshift="h+1c"
213-
):
213+
with fig.subplot(nrows=1, ncols=1, figsize=("15c", "3c"), autolabel="a)"):
214214
fig.basemap(
215215
region=[0, 10, 0, 10], projection="X?", frame=["af", "WSne"], panel=[0, 0]
216216
)
@@ -223,14 +223,15 @@
223223
# We start by drawing the bottom two subplots, setting ``autolabel="b)"`` so
224224
# that the subplots are labelled 'b)' and 'c)'. Then, we plot a single subplot
225225
# on the top row by using ``fig.subplot(..., yshift="h+1c")`` which shifts the
226-
# plot origin 1 cm beyond the **h**\ eight of the previous (bottom row) plot.
227-
# You may need to adjust this ``yshift`` parameter to make your plot look nice.
228-
# This top row uses ``autolabel="a)"``, and we also plotted some text inside.
229-
# Note that ``projection="X?"`` was used to let GMT automatically determine the
230-
# size of the subplot according to the size of the subplot area.
226+
# plot origin 1 cm above the **h**\ eight of the entire figure that is
227+
# currently plotted (i.e. the bottom row subplots). You may need to adjust this
228+
# ``yshift`` parameter to make your plot look nice. This top row uses
229+
# ``autolabel="a)"``, and we also plotted some text inside. Note that
230+
# ``projection="X?"`` was used to let GMT automatically determine the size of
231+
# the subplot according to the size of the subplot area.
231232

232233
###############################################################################
233234
# You can also manually override the ``autolabel`` for each subplot using for
234-
# example, ``fig.set_panel(..., fixedlabel="b) Panel 2"`` which would allow you
235-
# to manually label a single subplot as you wish. This can be useful for adding
236-
# a more descriptive subtitle to individual subplots.
235+
# example, ``fig.set_panel(..., fixedlabel="b) Panel 2")`` which would allow
236+
# you to manually label a single subplot as you wish. This can be useful for
237+
# adding a more descriptive subtitle to individual subplots.

pygmt/src/subplot.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
5454
ncols : int
5555
Number of horizontal columns of the subplot grid.
5656
figsize : tuple
57-
Specify the final figure dimensions as ``(width, height)``.
57+
Specify the final figure dimensions as (*width*, *height*).
5858
subsize : tuple
59-
Specify the dimensions of each subplot directly as ``(width, height)``.
59+
Specify the dimensions of each subplot directly as (*width*, *height*).
6060
Note that only one of ``figsize`` or ``subsize`` can be provided at
6161
once.
6262
@@ -153,10 +153,10 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
153153
kwargs["T"] = f'"{kwargs.get("T")}"' if kwargs.get("T") else None
154154

155155
if nrows < 1 or ncols < 1:
156-
raise GMTInvalidInput("Please ensure that both `nrows`>=1 and `ncols`>=1.")
156+
raise GMTInvalidInput("Please ensure that both 'nrows'>=1 and 'ncols'>=1.")
157157
if kwargs.get("Ff") and kwargs.get("Fs"):
158158
raise GMTInvalidInput(
159-
"Please provide either one of `figsize` or `subsize` only."
159+
"Please provide either one of 'figsize' or 'subsize' only."
160160
)
161161

162162
with Session() as lib:
@@ -177,12 +177,12 @@ def set_panel(self, panel=None, **kwargs):
177177
Set the current subplot panel to plot on.
178178
179179
Before you start plotting you must first select the active subplot. Note:
180-
If any *projection* option is passed with **?** as scale or width when
181-
plotting subplots, then the dimensions of the map are automatically
182-
determined by the subplot size and your region. For Cartesian plots: If you
183-
want the scale to apply equally to both dimensions then you must specify
184-
``projection="x"`` [The default ``projection="X"`` will fill the subplot by
185-
using unequal scales].
180+
If any *projection* option is passed with the question mark **?** as scale
181+
or width when plotting subplots, then the dimensions of the map are
182+
automatically determined by the subplot size and your region. For Cartesian
183+
plots: If you want the scale to apply equally to both dimensions then you
184+
must specify ``projection="x"`` [The default ``projection="X"`` will fill
185+
the subplot by using unequal scales].
186186
187187
{aliases}
188188

0 commit comments

Comments
 (0)