-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add non-geographic plots to projection gallery (#728)
* Add cartesian.py * Add polar.py
- Loading branch information
1 parent
6434b55
commit 47fbf9c
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Cartesian | ||
========= | ||
``Xwidth/[height]``: Give the ``width`` of the figure and the optional argument ``height``. | ||
""" | ||
import pygmt | ||
|
||
fig = pygmt.Figure() | ||
fig.plot( | ||
# The ``x`` and ``y`` parameters are used to plot lines on the figure. | ||
x=[3, 9, 2], | ||
y=[4, 9, 37], | ||
pen="3p,red", | ||
# ``region`` sets the x and y ranges or the Cartesian figure. | ||
region=[0, 10, 0, 50], | ||
# The argument ``WSne`` is passed to ``frame`` to put axis labels only on the left and bottom axes. | ||
projection="X15c/10c", | ||
frame=["af", "WSne"], | ||
) | ||
fig.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Polar | ||
===== | ||
``Pwidth``: Give the ``width`` of the figure. | ||
""" | ||
import pygmt | ||
|
||
fig = pygmt.Figure() | ||
fig.plot( | ||
# x inputs are the theta values for a polar plot. | ||
x=[180, 120, 270, 60, 0], | ||
# y inputs are the radius values for a polar plot. | ||
y=[15, 35, 15, 35, 15], | ||
pen="2p,blue", | ||
# The region values are theta-min/theta-max/radius-min/radius-max. | ||
region=[0, 360, 0, 40], | ||
projection="P15c", | ||
frame=["afg"], | ||
) | ||
fig.show() |