|
2 | 2 | Multi-parameter symbols
|
3 | 3 | =======================
|
4 | 4 |
|
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: |
8 | 8 |
|
9 | 9 | - **e**: ellipse
|
10 | 10 | - **j**: rotated rectangle
|
|
18 | 18 | import pygmt
|
19 | 19 |
|
20 | 20 | # %%
|
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. |
25 | 25 | #
|
26 | 26 | # The multi-parameter symbols in the ``style`` parameter are defined as:
|
27 | 27 | #
|
|
30 | 30 | # - **r**: rectangle, ``width/height``
|
31 | 31 | # - **R**: rounded rectangle, ``width/height/radius``
|
32 | 32 | # - **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. |
34 | 35 | #
|
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. |
37 | 38 |
|
38 | 39 | 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) |
40 | 41 |
|
41 | 42 | # Ellipse
|
42 | 43 | fig.plot(x=0.5, y=1, style="e45/3/1", fill="orange", pen="2p,black")
|
|
48 | 49 | fig.plot(x=4.5, y=1, style="R1.25/4/0.5", fill="seagreen", pen="2p,black")
|
49 | 50 | # Pie wedge
|
50 | 51 | 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") |
51 | 54 |
|
52 | 55 | fig.show()
|
53 | 56 |
|
54 | 57 | # %%
|
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``. |
59 | 62 | #
|
60 | 63 | # The symbol parameters in the 2-D list or numpy array are defined as:
|
61 | 64 | #
|
62 | 65 | # - **e**: ellipse, ``[[lon, lat, direction, major_axis, minor_axis]]``
|
63 | 66 | # - **j**: rotated rectangle, ``[[lon, lat, direction, width, height]]``
|
64 | 67 | # - **r**: rectangle, ``[[lon, lat, width, height]]``
|
65 | 68 | # - **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 |
69 | 71 |
|
70 | 72 | 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"]) |
72 | 74 |
|
73 | 75 | # Ellipse
|
74 | 76 | data = [[0.5, 1, 45, 3, 1], [0.5, 3, 135, 2, 1]]
|
|
85 | 87 | # Pie wedge
|
86 | 88 | data = [[5.5, 1, 2.5, 45, 330], [5.5, 3, 1.5, 60, 300]]
|
87 | 89 | 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") |
88 | 93 |
|
89 | 94 | fig.show()
|
90 | 95 |
|
|
0 commit comments