Skip to content

Commit ef71a9d

Browse files
DOC/Gallery example "Multi-parameter symbols": Show applying a inner diameter ("+i") to a pie wedge ("w") (#3624)
1 parent f76d25e commit ef71a9d

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

examples/gallery/symbols/multi_parameter_symbols.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Multi-parameter symbols
33
=======================
44
5-
The :meth:`pygmt.Figure.plot` method can plot individual multi-parameter
6-
symbols by passing the corresponding shortcuts (**e**, **j**, **r**, **R**,
7-
**w**) to the ``style`` parameter:
5+
The :meth:`pygmt.Figure.plot` method can plot individual multi-parameter symbols by
6+
passing the corresponding shortcuts (**e**, **j**, **r**, **R**, **w**) to the ``style``
7+
parameter:
88
99
- **e**: ellipse
1010
- **j**: rotated rectangle
@@ -18,10 +18,10 @@
1818
import pygmt
1919

2020
# %%
21-
# We can plot multi-parameter symbols using the same symbol style. We need to
22-
# define locations (lon, lat) via the ``x`` and ``y`` parameters (scalar for
23-
# a single symbol or 1-D list for several ones) and two or three symbol
24-
# parameters after those shortcuts via the ``style`` parameter.
21+
# We can plot multi-parameter symbols using the same symbol style. We need to define
22+
# locations (lon, lat) via the ``x`` and ``y`` parameters (scalar for a single symbol or
23+
# 1-D list for several ones) and two or three symbol parameters after those shortcuts
24+
# via the ``style`` parameter.
2525
#
2626
# The multi-parameter symbols in the ``style`` parameter are defined as:
2727
#
@@ -30,13 +30,14 @@
3030
# - **r**: rectangle, ``width/height``
3131
# - **R**: rounded rectangle, ``width/height/radius``
3232
# - **w**: pie wedge, ``diameter/startdir/stopdir``, the last two arguments are
33-
# directions given in degrees counter-clockwise from horizontal
33+
# directions given in degrees counter-clockwise from horizontal. Append **+i** and the
34+
# desired value to apply an inner diameter.
3435
#
35-
# Upper-case versions **E**, **J**, and **W** are similar to **e**, **j**, and
36-
# **w** but expect geographic azimuths and distances.
36+
# Upper-case versions **E**, **J**, and **W** are similar to **e**, **j**, and **w**
37+
# but expect geographic azimuths and distances.
3738

3839
fig = pygmt.Figure()
39-
fig.basemap(region=[0, 6, 0, 2], projection="x3c", frame=True)
40+
fig.basemap(region=[0, 7, 0, 2], projection="x3c", frame=True)
4041

4142
# Ellipse
4243
fig.plot(x=0.5, y=1, style="e45/3/1", fill="orange", pen="2p,black")
@@ -48,27 +49,28 @@
4849
fig.plot(x=4.5, y=1, style="R1.25/4/0.5", fill="seagreen", pen="2p,black")
4950
# Pie wedge
5051
fig.plot(x=5.5, y=1, style="w2.5/45/330", fill="lightgray", pen="2p,black")
52+
# Ring sector
53+
fig.plot(x=6.5, y=1, style="w2.5/45/330+i1", fill="lightgray", pen="2p,black")
5154

5255
fig.show()
5356

5457
# %%
55-
# We can also plot symbols with varying parameters via defining those values in
56-
# a 2-D list or numpy array (``[[parameters]]`` for a single symbol or
57-
# ``[[parameters_1],[parameters_2],[parameters_i]]`` for several ones) or using
58-
# an appropriately formatted input file and passing it to ``data``.
58+
# We can also plot symbols with varying parameters via defining those values in a 2-D
59+
# list or numpy array (``[[parameters]]`` for a single symbol or
60+
# ``[[parameters_1],[parameters_2],[parameters_i]]`` for several ones) or using an
61+
# appropriately formatted input file and passing it to ``data``.
5962
#
6063
# The symbol parameters in the 2-D list or numpy array are defined as:
6164
#
6265
# - **e**: ellipse, ``[[lon, lat, direction, major_axis, minor_axis]]``
6366
# - **j**: rotated rectangle, ``[[lon, lat, direction, width, height]]``
6467
# - **r**: rectangle, ``[[lon, lat, width, height]]``
6568
# - **R**: rounded rectangle, ``[[lon, lat, width, height, radius]]``
66-
# - **w**: pie wedge, ``[[lon, lat, diameter, startdir, stopdir]]``, the last
67-
# two arguments are directions given in degrees counter-clockwise from
68-
# horizontal
69+
# - **w**: pie wedge, ``[[lon, lat, diameter, startdir, stopdir]]``, the last two
70+
# arguments are directions given in degrees counter-clockwise from horizontal
6971

7072
fig = pygmt.Figure()
71-
fig.basemap(region=[0, 6, 0, 4], projection="x3c", frame=["xa1f0.2", "ya0.5f0.1"])
73+
fig.basemap(region=[0, 7, 0, 4], projection="x3c", frame=["xa1f0.2", "ya0.5f0.1"])
7274

7375
# Ellipse
7476
data = [[0.5, 1, 45, 3, 1], [0.5, 3, 135, 2, 1]]
@@ -85,6 +87,9 @@
8587
# Pie wedge
8688
data = [[5.5, 1, 2.5, 45, 330], [5.5, 3, 1.5, 60, 300]]
8789
fig.plot(data=data, style="w", fill="lightgray", pen="2p,black")
90+
# Ring sector
91+
data = [[6.5, 1, 2.5, 45, 330], [6.5, 3, 1.5, 60, 300]]
92+
fig.plot(data=data, style="w+i1", fill="lightgray", pen="2p,black")
8893

8994
fig.show()
9095

0 commit comments

Comments
 (0)