Skip to content

Commit 47fbf9c

Browse files
Add non-geographic plots to projection gallery (#728)
* Add cartesian.py * Add polar.py
1 parent 6434b55 commit 47fbf9c

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Cartesian
3+
=========
4+
5+
``Xwidth/[height]``: Give the ``width`` of the figure and the optional argument ``height``.
6+
"""
7+
import pygmt
8+
9+
fig = pygmt.Figure()
10+
fig.plot(
11+
# The ``x`` and ``y`` parameters are used to plot lines on the figure.
12+
x=[3, 9, 2],
13+
y=[4, 9, 37],
14+
pen="3p,red",
15+
# ``region`` sets the x and y ranges or the Cartesian figure.
16+
region=[0, 10, 0, 50],
17+
# The argument ``WSne`` is passed to ``frame`` to put axis labels only on the left and bottom axes.
18+
projection="X15c/10c",
19+
frame=["af", "WSne"],
20+
)
21+
fig.show()

examples/projections/nongeo/polar.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
Polar
3+
=====
4+
5+
``Pwidth``: Give the ``width`` of the figure.
6+
7+
"""
8+
import pygmt
9+
10+
fig = pygmt.Figure()
11+
fig.plot(
12+
# x inputs are the theta values for a polar plot.
13+
x=[180, 120, 270, 60, 0],
14+
# y inputs are the radius values for a polar plot.
15+
y=[15, 35, 15, 35, 15],
16+
pen="2p,blue",
17+
# The region values are theta-min/theta-max/radius-min/radius-max.
18+
region=[0, 360, 0, 40],
19+
projection="P15c",
20+
frame=["afg"],
21+
)
22+
fig.show()

0 commit comments

Comments
 (0)