Skip to content

Commit 5522814

Browse files
DOC/Gallery example "Configuring PyGMT defaults": General improvements (#3633)
1 parent 00fe62d commit 5522814

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

examples/tutorials/advanced/configuration.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
Configuring PyGMT defaults
33
==========================
44
5-
Default GMT parameters can be set globally or locally using
6-
:class:`pygmt.config`.
5+
Default GMT parameters can be set globally or locally using :class:`pygmt.config`.
76
"""
87

98
# %%
@@ -13,9 +12,9 @@
1312
# Configuring default GMT parameters
1413
# ----------------------------------
1514
#
16-
# Users can override default parameters either temporarily (locally) or
17-
# permanently (globally) using :class:`pygmt.config`. The full list of default
18-
# parameters that can be changed can be found at :gmt-docs:`gmt.conf.html`.
15+
# Users can override default parameters either temporarily (locally) or permanently
16+
# (globally) using :class:`pygmt.config`. The full list of default parameters that can
17+
# be changed can be found at :gmt-docs:`gmt.conf.html`.
1918
#
2019
# We demonstrate the usage of :class:`pygmt.config` by configuring a map plot.
2120

@@ -31,18 +30,17 @@
3130
# Globally overriding defaults
3231
# ----------------------------
3332
#
34-
# The ``MAP_FRAME_TYPE`` parameter specifies the style of map frame to use, of
35-
# which there are 5 options: ``fancy`` (default, see above), ``fancy+``,
36-
# ``plain``, ``graph`` (which does not apply to geographical maps) and
37-
# ``inside``.
33+
# The ``MAP_FRAME_TYPE`` parameter specifies the style of map frame to use, of which
34+
# there are 5 options: ``fancy`` (default, see above), ``fancy+``, ``plain``, ``graph``
35+
# (which does not apply to geographical maps) and ``inside``.
3836
#
39-
# The ``FORMAT_GEO_MAP`` parameter controls the format of geographical tick
40-
# annotations. The default uses degrees and minutes. Here we specify the ticks
41-
# to be a decimal number of degrees.
37+
# The ``FORMAT_GEO_MAP`` parameter controls the format of geographical tick annotations.
38+
# The default uses degrees and minutes. Here we specify the ticks to be a decimal number
39+
# of degrees.
4240

4341
fig = pygmt.Figure()
4442

45-
# Configuration for the 'current figure'.
43+
# Configuration for the 'current figure'
4644
pygmt.config(MAP_FRAME_TYPE="plain")
4745
pygmt.config(FORMAT_GEO_MAP="ddd.xx")
4846

@@ -56,14 +54,13 @@
5654
# Locally overriding defaults
5755
# ---------------------------
5856
#
59-
# It is also possible to temporarily override the default parameters, which is
60-
# very useful for limiting the scope of changes to a particular plot.
61-
# :class:`pygmt.config` is implemented as a context manager, which handles the
62-
# setup and teardown of a GMT session. Python users are likely familiar with
63-
# the ``with open(...) as file:`` snippet, which returns a ``file`` context
64-
# manager. In this way, it can be used to override a parameter for a single
65-
# command, or a sequence of commands. An application of :class:`pygmt.config`
66-
# as a context manager is shown below:
57+
# It is also possible to temporarily override the default parameters, which is very
58+
# useful for limiting the scope of changes to a particular plot. :class:`pygmt.config`
59+
# is implemented as a context manager, which handles the setup and teardown of a GMT
60+
# session. Python users are likely familiar with the ``with open(...) as file:``
61+
# snippet, which returns a ``file`` context manager. In this way, it can be used to
62+
# override a parameter for a single command, or a sequence of commands. An application
63+
# of :class:`pygmt.config` as a context manager is shown below:
6764

6865
fig = pygmt.Figure()
6966

@@ -72,8 +69,8 @@
7269
fig.basemap(region=[115, 119.5, 4, 7.5], projection="M10c", frame=True)
7370
fig.coast(land="black", water="skyblue")
7471

75-
# Shift plot origin down by 10cm to plot another map
76-
fig.shift_origin(yshift="-10c")
72+
# Shift plot origin down by the height of the figure to plot another map
73+
fig.shift_origin(yshift="-h")
7774

7875
# This figure retains the default "fancy" frame
7976
fig.basemap(region=[115, 119.5, 4, 7.5], projection="M10c", frame=True)

0 commit comments

Comments
 (0)