Skip to content

Commit

Permalink
Improve projection tutorials (#816)
Browse files Browse the repository at this point in the history
Style changes and fixes in the example projection gallery files.
  • Loading branch information
seisman authored Jan 29, 2021
1 parent 4ed63f8 commit c27f1bf
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 26 deletions.
6 changes: 3 additions & 3 deletions examples/projections/azim/azim_equidistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
**e**\ *lon0/lat0*\ [*/horizon*]\ */scale* or
**E**\ *lon0/lat0*\ [*/horizon*]\ */width*
The projection type is set with **e** or **E**, *lon0/lat0* specifies the projection
center, and the optional parameter *horizon* specifies the max distance to the
The projection type is set with **e** or **E**. *lon0/lat0* specifies the projection
center, and the optional parameter *horizon* specifies the maximum distance to the
projection center (i.e. the visibile portion of the rest of the world map) in
degrees <= 180° (default 180°). The size of the figure is set by *scale* or *width*.
"""
import pygmt

fig = pygmt.Figure()
fig.coast(projection="E-100/40/4.5i", region="g", frame="g", land="gray")
fig.coast(projection="E-100/40/15c", region="g", frame="g", land="gray")
fig.show()
4 changes: 2 additions & 2 deletions examples/projections/azim/azim_general_perspective.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
degrees). *Width* and *Height* describe the viewport angle in degrees, and *scale*
or *width* determine the size of the figure.
The example shows the coast of northern europe viewed from 250 km above sea
The example shows the coast of Northern Europe viewed from 250 km above sea
level looking 30° from north at a tilt of 45°. The height and width of the
viewing angle is both 60°, which imitates viewing with naked eye.
"""
import pygmt

fig = pygmt.Figure()
fig.coast(
projection="G4/52/250/30/45/0/60/60/5i",
projection="G4/52/250/30/45/0/60/60/12c",
region="g",
frame=["x10g10", "y5g5"],
land="gray",
Expand Down
4 changes: 2 additions & 2 deletions examples/projections/azim/azim_general_stereographic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
or **S**\ *lon0/lat0*\ [*/horizon*\]\ */width*
The projection type is set with **s** or **S**. *lon0/lat0* specifies the
projection center, the optional *horizon* parameter specifies the max distance from
projection center, the optional *horizon* parameter specifies the maximum distance from
projection center (in degrees, < 180, default 90), and the *scale* or *width* sets the
size of the figure.
"""
import pygmt

fig = pygmt.Figure()
fig.coast(region="4/14/52/57", projection="S0/90/4.5i", frame="ag", land="gray")
fig.coast(region=[4, 14, 52, 57], projection="S0/90/12c", frame="ag", land="gray")
fig.show()
6 changes: 3 additions & 3 deletions examples/projections/azim/azim_gnomonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
========
The point of perspective of the gnomonic projection lies at the center of the
earth. As a consequence great circles (orthodromes) on the surface of the earth
earth. As a consequence great circles (orthodromes) on the surface of the Earth
are displayed as straight lines, which makes it suitable for distance estimation
for navigational purposes. It is neither conformal nor equal-area and the
distortion increases greatly with distance to the projection center. It follows
Expand All @@ -14,12 +14,12 @@
or **F**\ *lon0/lat0*\ [*/horizon*\ ]\ */width*
**f** or **F** specifies the projection type, *lon0/lat0* specifies the projection
center, the optional parameter *horizon* specifies the max distance from projection
center, the optional parameter *horizon* specifies the maximum distance from projection
center (in degrees, < 90, default 60), and *scale* or *width* sets the size of the
figure.
"""
import pygmt

fig = pygmt.Figure()
fig.coast(projection="F-90/15/4.5i", region="g", frame="20g20", land="gray")
fig.coast(projection="F-90/15/12c", region="g", frame="20g20", land="gray")
fig.show()
4 changes: 2 additions & 2 deletions examples/projections/azim/azim_lambert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
or **A**\ *lon0/lat0*\ [*/horizon*\ ]\ */width*
**a** or **A** specifies the projection type, and *lon0/lat0* specifies the projection
center, *horizon* specifies the max distance from projection center (in degrees,
center, *horizon* specifies the maximum distance from projection center (in degrees,
<= 180, default 90), and *scale* or *width* sets the size of the figure.
"""
import pygmt

fig = pygmt.Figure()
fig.coast(region="g", frame="afg", land="gray", projection="A30/-20/60/8i")
fig.coast(region="g", frame="afg", land="gray", projection="A30/-20/60/12c")
fig.show()
4 changes: 2 additions & 2 deletions examples/projections/azim/azim_orthographic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
or **G**\ *lon0/lat0*\ [*/horizon*\ ]\ */width*
**g** or **G** specifies the projection type, *lon0/lat0* specifies the projection
center, the optional parameter *horizon* specifies the max distance from projection
center, the optional parameter *horizon* specifies the maximum distance from projection
center (in degrees, <= 90, default 90), and *scale* and *width* set the figure size.
"""
import pygmt

fig = pygmt.Figure()
fig.coast(projection="G10/52/4.5i", region="g", frame="g", land="gray")
fig.coast(projection="G10/52/12c", region="g", frame="g", land="gray")
fig.show()
2 changes: 1 addition & 1 deletion examples/projections/conic/conic_albers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
fig = pygmt.Figure()
# Use the ISO country code for Brazil and add a padding of 2 degrees (+R2)
fig.coast(
projection="B-55/-15/-25/0/8i", region="BR+R2", frame="afg", land="gray", borders=1
projection="B-55/-15/-25/0/12c", region="BR+R2", frame="afg", land="gray", borders=1
)
fig.show()
1 change: 0 additions & 1 deletion examples/projections/conic/conic_equidistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@
water="lightblue",
frame="afg",
)

fig.show()
2 changes: 1 addition & 1 deletion examples/projections/cyl/cyl_cassini.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

fig = pygmt.Figure()
# Use the ISO code for Madagascar (MG) and pad it by 2 degrees (+R2)
fig.coast(projection="C47/-19/8i", region="MG+R2", frame="afg", land="gray", borders=1)
fig.coast(projection="C47/-19/12c", region="MG+R2", frame="afg", land="gray", borders=1)
fig.show()
2 changes: 1 addition & 1 deletion examples/projections/cyl/cyl_mercator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
**m**\ [*lon0[/lat0]*]\ */scale* or **M**\ [*lon0*][*/lat0*]\ */width*
The projection is set with **m** or **M**. The central meridian is set with the
option *lon0* and the standard parallel is set with the option *lat0*.
optional *lon0* and the standard parallel is set with the optional *lat0*.
The figure size is set with *scale* or *width*.
"""
import pygmt
Expand Down
2 changes: 1 addition & 1 deletion examples/projections/cyl/cyl_stereographic.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
import pygmt

fig = pygmt.Figure()
fig.coast(region="g", frame="afg", land="gray", projection="Cyl_stere/30/-20/8i")
fig.coast(region="g", frame="afg", land="gray", projection="Cyl_stere/30/-20/12c")
fig.show()
6 changes: 3 additions & 3 deletions examples/projections/nongeo/cartesian_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
Cartesian linear
================
``Xwidth/[height]``: Give the ``width`` of the figure and the optional argument ``height``.
**X**\ *width*/[*height*]: Give the *width* of the figure and the optional *height*.
"""
import pygmt

fig = pygmt.Figure()
fig.plot(
# The ``x`` and ``y`` parameters are used to plot lines on the figure.
# The ``x`` and ``y`` arguments determine the coordinates of lines
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",
# ``WSne`` is passed to ``frame`` to put axis labels only on the left and bottom axes.
frame=["af", "WSne"],
)
fig.show()
6 changes: 3 additions & 3 deletions examples/projections/nongeo/cartesian_logarithmic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Cartesian logarithmic
=====================
``xwidth[l]/[height[l]]``: Give the ``width`` of the figure and the optional argument \
``height``. The axis or axes with a logarithmic transformation requires ``l`` after
its size argument.
**X**\ *width*\ [**l**]/[*height*\ [**l**]]: Give the *width* of the figure and
the optional *height*. The axis or axes with a logarithmic transformation requires
**l** after its size argument.
"""
import numpy as np
import pygmt
Expand Down
2 changes: 1 addition & 1 deletion examples/projections/nongeo/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Polar
=====
``Pwidth``: Give the ``width`` of the figure.
**P**\ *width*: Give the *width* of the figure.
"""
import pygmt
Expand Down

0 comments on commit c27f1bf

Please sign in to comment.