How to use the pygmt.Figure function in pygmt

To help you get started, we’ve selected a few pygmt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GenericMappingTools / pygmt / dev / _downloads / 29ea8d0bf6fbe57cd57e12a636ee5dfc / azim_lambert.py View on Github external
"""
Lambert Azimuthal Equal Area
============================

``Alon0/lat0[/horizon]/width``: ``lon0`` and ``lat0`` specifies the projection center.
``horizon`` specifies the max distance from projection center (in degrees, <= 180,
default 90).
"""
import pygmt

fig = pygmt.Figure()
fig.coast(region="g", frame="afg", land="gray", projection="A30/-20/60/8i")
fig.show()
github GenericMappingTools / pygmt / dev / _downloads / 85bd7795caf2775b21629621fe089c88 / cyl_mercator.py View on Github external
"""
Mercator
========

``M[lon0/][lat0/]width``: Give central meridian ``lon0`` (optional) and
standard parallel ``lat0`` (optional).
"""
import pygmt

fig = pygmt.Figure()
fig.coast(region=[0, 360, -80, 80], frame="afg", land="gray", projection="M0/0/8i")
fig.show()
github GenericMappingTools / pygmt / examples / projections / cyl / cyl_cassini.py View on Github external
"""
Cassini Cylindrical
============================

``Clon0/lat0/width``: ``lon0`` and ``lat0`` specifies the projection center.
"""
import pygmt

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.show()
github GenericMappingTools / pygmt / dev / _downloads / 804933c00171bd80c8cb60638d8f2bc2 / coastlines.py View on Github external
########################################################################################
# Resolutions
# -----------
#
# The coastline database comes with 5 resolutions. The resolution drops by 80% between
# levels:
#
# 1. ``"c"``: crude
# 2. ``"l"``: low (default)
# 3. ``"i"``: intermediate
# 4. ``"h"``: high
# 5. ``"f"``: full

oahu = [-158.3, -157.6, 21.2, 21.8]
fig = pygmt.Figure()
for res in ["c", "l", "i", "h", "f"]:
    fig.coast(resolution=res, shorelines="1p", region=oahu, projection="M5i")
    fig.shift_origin(xshift="5i")
fig.show()

########################################################################################
# Land and water
# --------------
#
# Use the ``land`` and ``water`` attributes to specify a fill color for land and water
# bodies. The colors can be given by name or hex codes (like the ones used in HTML and
# CSS):

fig = pygmt.Figure()
fig.basemap(region="g", projection="W10i", frame=True)
fig.coast(land="#666666", water="skyblue")
github GenericMappingTools / pygmt / examples / gallery / plot / legend.py View on Github external
"""
Legend
------

The :meth:`pygmt.Figure.legend` method can automatically create a legend for
symbols plotted using :meth:`pygmt.Figure.plot`. Legend entries are only
created when the ``label`` argument is used.
"""
import pygmt

fig = pygmt.Figure()

fig.basemap(projection="x1i", region=[0, 7, 3, 7], frame=True)

fig.plot(
    data="@Table_5_11.txt",
    style="c0.15i",
    color="lightgreen",
    pen="faint",
    label="Apples",
)
fig.plot(data="@Table_5_11.txt", pen="1.5p,gray", label='"My lines"')
fig.plot(data="@Table_5_11.txt", style="t0.15i", color="orange", label="Oranges")

fig.legend(position="JTR+jTR+o0.2c", box=True)

fig.show()
github GenericMappingTools / pygmt / dev / _downloads / 0f468c1560c883c48031feea6bde1110 / land_and_water.py View on Github external
"""
Color land and water
--------------------

The ``land`` and ``water`` arguments of :meth:`pygmt.Figure.coast` specify a color to
fill in the land and water masses, respectively. You can use standard GMT color names or
give a hex value (like ``#333333``).
"""
import pygmt

fig = pygmt.Figure()
# Make a global Mollweide map with automatic ticks
fig.basemap(region="g", projection="W8i", frame=True)
# Plot the land as light gray
fig.coast(land="#666666", water="skyblue")
fig.show()
github GenericMappingTools / pygmt / dev / _downloads / fa2673373a3d041d6a3d32e769a4687e / conic_albers.py View on Github external
"""
Albers Conic Equal Area
=======================

``Blon0/lat0/lat1/lat2/width``: Give projection center ``lon0/lat0`` and two standard
parallels ``lat1/lat2``.
"""
import pygmt

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
)
fig.show()
github GenericMappingTools / pygmt / dev / _downloads / 21fcfe2acf05db8545d24de35dded39f / cyl_cassini.py View on Github external
"""
Cassini Cylindrical
============================

``Clon0/lat0/width``: ``lon0`` and ``lat0`` specifies the projection center.
"""
import pygmt

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.show()
github GenericMappingTools / pygmt / dev / _downloads / 58d87c29128f202a59b161adaf8976c4 / frames.py View on Github external
########################################################################################
# Plot frame
# ----------
#
# By default, PyGMT does not add a frame to your plot. For example, we can plot the
# coastlines of the world with a Mercator projection:

fig = pygmt.Figure()
fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i")
fig.show()

########################################################################################
# To add the default GMT frame to the plot, use ``frame="f"`` in
# :meth:`pygmt.Figure.basemap` or any other plotting module:

fig = pygmt.Figure()
fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i")
fig.basemap(frame="f")
fig.show()

########################################################################################
# Ticks and grid lines
# --------------------
#
# The automatic frame (``frame=True`` or ``frame="a"``) sets the default GMT style frame
# and automatically determines tick labels from the plot region.

fig = pygmt.Figure()
fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i")
fig.basemap(frame="a")
fig.show()