|
| 1 | +""" |
| 2 | +Multi-parameter symbols |
| 3 | +------------------------- |
| 4 | +
|
| 5 | +The :meth:`pygmt.Figure.plot` method can plot individual multi-parameter symbols by passing |
| 6 | +the corresponding shortcuts listed below to the ``style`` option. Additionally, we must define |
| 7 | +the required parameters in a 2d list or numpy array (``[[parameters]]`` for a single symbol |
| 8 | +or ``[[parameters_1],[parameters_2],[parameters_i]]`` for several ones) or use an |
| 9 | +appropriately formatted input file and pass it to ``data``. |
| 10 | +
|
| 11 | +The following symbols are available: |
| 12 | +
|
| 13 | +- **e**: ellipse, ``[[lon, lat, direction, major_axis, minor_axis]]`` |
| 14 | +- **j**: rotated rectangle, ``[[lon, lat, direction, width, height]]`` |
| 15 | +- **r**: rectangle, ``[[lon, lat, width, height]]`` |
| 16 | +- **R**: rounded rectangle, ``[[lon, lat, width, height, radius]]`` |
| 17 | +- **w**: pie wedge, ``[[lon, lat, radius, startdir, stopdir]]``, the last two arguments are |
| 18 | + directions given in degrees counter-clockwise from horizontal |
| 19 | +
|
| 20 | +Upper-case versions **E**, **J**, and **W** are similar to **e**, **j** and **w** but expect geographic |
| 21 | +azimuths and distances. |
| 22 | +
|
| 23 | +For more advanced options, see the full option list at :gmt-docs:`plot.html`. |
| 24 | +""" |
| 25 | + |
| 26 | +import numpy as np |
| 27 | +import pygmt |
| 28 | + |
| 29 | +fig = pygmt.Figure() |
| 30 | + |
| 31 | +fig.basemap(region=[0, 6, 0, 2], projection="x3c", frame=True) |
| 32 | + |
| 33 | +################### |
| 34 | +# ELLIPSE |
| 35 | +data = np.array([[0.5, 1, 45, 3, 1]]) |
| 36 | + |
| 37 | +fig.plot(data=data, style="e", color="orange", pen="2p,black") |
| 38 | + |
| 39 | +################### |
| 40 | +# ROTATED RECTANGLE |
| 41 | +data = np.array([[1.5, 1, 120, 5, 0.5]]) |
| 42 | + |
| 43 | +fig.plot(data=data, style="j", color="red3", pen="2p,black") |
| 44 | + |
| 45 | +################### |
| 46 | +# RECTANGLE |
| 47 | +data = np.array([[3, 1, 4, 1.5]]) |
| 48 | + |
| 49 | +fig.plot(data=data, style="r", color="dodgerblue", pen="2p,black") |
| 50 | + |
| 51 | +################### |
| 52 | +# ROUNDED RECTANGLE |
| 53 | +data = np.array([[4.5, 1, 1.25, 4, 0.5]]) |
| 54 | + |
| 55 | +fig.plot(data=data, style="R", color="seagreen", pen="2p,black") |
| 56 | + |
| 57 | +################### |
| 58 | +# PIE WEDGE |
| 59 | +data = np.array([[5.5, 1, 2.5, 45, 330]]) |
| 60 | + |
| 61 | +fig.plot(data=data, style="w", color="lightgray", pen="2p,black") |
| 62 | + |
| 63 | +fig.show() |
0 commit comments