Skip to content

Commit

Permalink
Deploy v0.14.0 from 2a84b5e
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 31, 2024
1 parent 38822bf commit dcea033
Show file tree
Hide file tree
Showing 1,420 changed files with 196,737 additions and 1 deletion.
2 changes: 1 addition & 1 deletion latest
4 changes: 4 additions & 0 deletions v0.14.0/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0cae6ce2c28fafe2a0bdbf7c7991337a
tags: 645f666f9bcd5a90fca523b33c5a78b7
61 changes: 61 additions & 0 deletions v0.14.0/_downloads/004f6d23a04369ca0db9c83de3b6182d/scalebar.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Scale bar\n\nThe ``map_scale`` parameter of the :meth:`pygmt.Figure.basemap` and\n:meth:`pygmt.Figure.coast` methods is used to add a scale bar to a map.\nThis example shows how such a scale bar can be customized:\n\n - position: **g**\\|\\ **j**\\|\\ **J**\\|\\ **n**\\|\\ **x**. Set the position\n of the reference point. Choose from\n\n - **g**: Give map coordinates as *longitude*\\/\\ *latitude*.\n - **j**\\|\\ **J**: Specify a two-character (order independent) code.\n Choose from vertical **T**\\(op), **M**\\(iddle), or **B**\\(ottom) and\n horizontal **L**\\(eft), **C**\\(entre), or **R**\\(ight). Lower / upper\n case **j** / **J** mean inside / outside of the map bounding box.\n - **n**: Give normalized bounding box coordinates as *nx*\\/\\ *ny*.\n - **x**: Give plot coordinates as *x*\\/\\ *y*.\n\n - length: **+w**. Give a distance value, and, optionally a distance unit.\n Choose from **e** (meters), **f** (feet), **k** (kilometers) [Default],\n **M** (statute miles), **n** (nautical miles), or **u** (US survey feet).\n - origin: **+c**\\ [*slon*/]\\ *slat*. Control where on the map the scale bar\n applies. If **+c** is not given the reference point is used. If only\n **+c** is appended the middle of the map is used. Note that *slon* is only\n optional for projections with constant scale along parallels, e.g.,\n Mercator projection.\n - justify: **+j**. Set the anchor point. Specify a two-character (order\n independent) code. Choose from vertical **T**\\(op), **M**\\(iddle), or\n **B**\\(ottom) and horizontal **L**\\(eft), **C**\\(entre), or **R**\\(ight).\n - offset: **+o**\\ *offset* or **+o**\\ *xoffset*/\\ *yoffset*. Give either a\n common shift or individual shifts in x (longitude) and y (latitude)\n directions.\n - height: Use :gmt-term:`MAP_SCALE_HEIGHT` via :func:`pygmt.config`.\n - fancy style: **+f**. Get a scale bar that looks like train tracks.\n - unit: **+u**. Add the distance unit given via **+w** to the single\n distance values.\n - label: **+l**. Add the distance unit given via **+w** as label. Append\n text to get a customized label instead.\n - alignment: **+a**. Set the label alignment. Choose from **t**\\(op)\n [Default], **b**\\(ottom), **l**\\(eft), or **r**\\(ight).\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pygmt\n\n# Create a new Figure instance\nfig = pygmt.Figure()\n\n# Mercator projection with 10 centimeters width\nfig.basemap(region=[-45, -25, -15, 0], projection=\"M0/0/10c\", frame=[\"WSne\", \"af\"])\n\n# -----------------------------------------------------------------------------\n# Top Left: Add a plain scale bar\n# It is placed based on geographic coordinates (g) 42\u00b0 West and 1\u00b0 South,\n# applies at the reference point (+c is not given), and represents a\n# length (+w) of 500 kilometers\nfig.basemap(map_scale=\"g-42/-1+w500k\")\n\n# -----------------------------------------------------------------------------\n# Top Right: Add a fancy scale bar\n# It is placed based on normalized bounding box coordinates (n)\n# Use a fancy style (+f) to get a scale bar that looks like train tracks\n# Add the distance unit (+u) to the single distance values\nfig.basemap(map_scale=\"n0.8/0.95+w500k+f+u\")\n\n# -----------------------------------------------------------------------------\n# Bottom Left: Add a thick scale bar\n# Adjust the GMT default parameter MAP_SCALE_HEIGHT locally (the change applies\n# only to the code within the \"with\" statement)\n# It applies (+c) at the middle of the map (no location is appended to +c)\n# Without appending text, +l adds the distance unit as label\nwith pygmt.config(MAP_SCALE_HEIGHT=\"10p\"):\n fig.basemap(map_scale=\"n0.2/0.15+c+w500k+f+l\")\n\n# -----------------------------------------------------------------------------\n# Bottom Right: Add a scale bar valid for a specific location\n# It is placed at BottomRight (j) using MiddleRight as anchor point (+j) with\n# an offset (+o) of 1 centimeter in both x and y directions\n# It applies (+c) at -7\u00b0 South, add a customized label by appending text to +l\nfig.basemap(map_scale=\"jBR+jMR+o1c/1c+c-7+w500k+f+u+lvalid at 7\u00b0 S\")\n\nfig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``box`` parameter allows surrounding the scale bar. This can be useful\nwhen adding a scale bar to a colorful map. To fill the box, append **+g**\nwith the desired color (or pattern). The outline of the box can be adjusted\nby appending **+p** with the desired thickness, color, and style. To force\nrounded edges append **+r** with the desired radius.\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Create a new Figure instance\nfig = pygmt.Figure()\n\nfig.coast(\n region=[-45, -25, -15, 0],\n projection=\"M10c\",\n land=\"tan\",\n water=\"steelblue\",\n frame=[\"WSne\", \"af\"],\n # Set the label alignment (+a) to right (r)\n map_scale=\"jBL+o1c/1c+c-7+w500k+f+lkm+ar\",\n # Fill the box in white with a transparency of 30 percent, add a solid\n # outline in darkgray (gray30) with a thickness of 0.5 points, and use\n # rounded edges with a radius of 3 points\n box=\"+gwhite@30+p0.5p,gray30,solid+r3p\",\n)\n\nfig.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
67 changes: 67 additions & 0 deletions v0.14.0/_downloads/011dc0cae17575719cab06d0e76a5649/patterns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""
Bit and hachure patterns
========================
In addition to colors, PyGMT also allows using bit and hachure patterns to fill
symbols, polygons, and other areas, via the ``fill`` parameter or similar parameters.
Example method parameters that support bit and hachure patterns include:
- :meth:`pygmt.Figure.coast`: Land and water masses via ``land`` and ``water``
- :meth:`pygmt.Figure.histogram`: Histogram bars via ``fill``
- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compressionfill`` and
``extensionfill``
- :meth:`pygmt.Figure.plot`: Symbols and polygons via ``fill``
- :meth:`pygmt.Figure.rose`: Histogram sectors via ``fill``
- :meth:`pygmt.Figure.solar`: Day-light terminators via ``fill``
- :meth:`pygmt.Figure.ternary`: Symbols via ``fill``
- :meth:`pygmt.Figure.velo`: Uncertainty wedges and velocity error ellipses via
``uncertaintyfill``
- :meth:`pygmt.Figure.wiggle`: Anomalies via ``fillpositive`` and ``fillnegative``
GMT provides 90 predefined patterns that can be used in PyGMT. The patterns are numbered
from 1 to 90, and can be colored and inverted. The resolution of the pattern
can be changed, and the background and foreground colors can be set. For a complete list
of available patterns and the full syntax to specify a pattern, refer to the
:doc:`/techref/patterns`.
"""

# %%
import pygmt

# A list of patterns that will be demonstrated.
# To use a pattern as fill append "p" and the number of the desired pattern.
# By default, the pattern is plotted in black and white with a resolution of 300 dpi.
patterns = [
# Plot a hachted pattern via pattern number 8
"p8",
# Plot a dotted pattern via pattern number 19
"p19",
# Set the background color ("+b") to "red3" and the foreground color ("+f") to
# "lightgray"
"p19+bred3+flightbrown",
# Invert the pattern by using a capitalized "P"
"P19+bred3+flightbrown",
# Change the resolution ("+r") to 100 dpi
"p19+bred3+flightbrown+r100",
# Make the background transparent by not giving a color after "+b";
# works analogous for the foreground
"p19+b+flightbrown+r100",
]

fig = pygmt.Figure()
fig.basemap(
region=[0, 10, 0, 12],
projection="X10c",
frame="rlbt+glightgray+tBit and Hachure Patterns",
)

y = 11
for pattern in patterns:
# Plot a square with the pattern as fill.
# The square has a size of 2 centimeters with a 1 point thick, black outline.
fig.plot(x=2, y=y, style="s2c", pen="1p,black", fill=pattern)
# Add a description of the pattern.
fig.text(x=4, y=y, text=pattern, font="Courier-Bold", justify="ML")
y -= 2
fig.show()
236 changes: 236 additions & 0 deletions v0.14.0/_downloads/020a0d3a1bf85b03399dbd49671e6702/regions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
"""
Setting the region
==================
Many of the plotting methods take the ``region`` parameter, which sets the
area that will be shown in the figure. This tutorial covers the different types
of inputs that it can accept.
"""

# %%
import pygmt

# %%
# Coordinates
# -----------
#
# A string of coordinates can be passed to ``region``, in the form of
# *xmin*/*xmax*/*ymin*/*ymax*.

fig = pygmt.Figure()
fig.coast(
# Set the x-range from 10E to 20E and the y-range to 35N to 45N
region="10/20/35/45",
# Set projection to Mercator, and the figure size to 15 centimeters
projection="M15c",
# Set the color of the land to light gray
land="lightgray",
# Set the color of the water to white
water="white",
# Display the national borders and set the pen thickness to 0.5p
borders="1/0.5p",
# Display the shorelines and set the pen thickness to 0.5p
shorelines="1/0.5p",
# Set the frame to display annotations and gridlines
frame="ag",
)
fig.show()

# %%
# The coordinates can be passed to ``region`` as a list, in the form of
# [*xmin*, *xmax*, *ymin*, *ymax*].

fig = pygmt.Figure()
fig.coast(
# Set the x-range from 10E to 20E and the y-range to 35N to 45N
region=[10, 20, 35, 45],
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# Instead of passing axes minima and maxima, the coordinates can be passed for
# the bottom-left and top-right corners. The string format takes the
# coordinates for the bottom-left and top-right coordinates. To specify corner
# coordinates, append **+r** at the end of the ``region`` string.

fig = pygmt.Figure()
fig.coast(
# Set the bottom-left corner as 10E, 35N and the top-right corner as
# 20E, 45N
region="10/35/20/45+r",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()


# %%
# Global regions
# --------------
#
# In addition to passing coordinates, the argument **d** can be passed to set
# the region to the entire globe. The range is 180W to 180E (-180, 180) and 90S
# to 90N (-90 to 90). With no parameters set for the projection, the figure
# defaults to be centered at the mid-point of both x- and y-axes. Using
# **d**\ , the figure is centered at (0, 0), or the intersection of the equator
# and prime meridian.

fig = pygmt.Figure()
fig.coast(
region="d",
projection="Cyl_stere/12c",
land="darkgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# The argument **g** can be passed, which encompasses the entire globe. The
# range is 0E to 360E (0, 360) and 90S to 90N (-90 to 90). With no parameters
# set for the projection, the figure is centered at (180, 0), or the
# intersection of the equator and International Date Line.

fig = pygmt.Figure()
fig.coast(
region="g",
projection="Cyl_stere/12c",
land="darkgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()


# %%
# ISO code
# --------
#
# The ``region`` can be set to include a specific area specified by the
# two-character ISO 3166-1 alpha-2 convention
# (for further information: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).

fig = pygmt.Figure()
fig.coast(
# Set the figure region to encompass Japan with the ISO code "JP"
region="JP",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# The area encompassed by the ISO code can be expanded by appending
# **+r**\ *increment* to the ISO code. The *increment* unit is in degrees, and
# if only one value is added it expands the range of the region in all
# directions. Using **+r** expands the final region boundaries to be multiples
# of *increment* .

fig = pygmt.Figure()
fig.coast(
# Expand the region boundaries to be multiples of 3 degrees in all
# directions
region="JP+r3",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# Instead of expanding the range of the plot uniformly in all directions, two
# values can be passed to expand differently on each axis. The format is
# *xinc*/*yinc*.

fig = pygmt.Figure()
fig.coast(
# Expand the region boundaries to be multiples of 3 degrees on the x-axis
# and 5 degrees on the y-axis.
region="JP+r3/5",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# Instead of expanding the range of the plot uniformly in all directions, four
# values can be passed to expand differently in each direction.
# The format is *winc*/*einc*/*sinc*/*ninc*, which expands on the west,
# east, south, and north axes.

fig = pygmt.Figure()
fig.coast(
# Expand the region boundaries to be multiples of 3 degrees to the west, 5
# degrees to the east, 7 degrees to the south, and 9 degrees to the north.
region="JP+r3/5/7/9",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# The ``region`` increment can be appended with **+R**, which adds the
# increment without rounding.

fig = pygmt.Figure()
fig.coast(
# Expand the region setting outside the range of Japan by 3 degrees in all
# directions, without rounding to the nearest increment.
region="JP+R3",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()

# %%
# The ``region`` increment can be appended with **+e**, which is like **+r**
# and expands the final region boundaries to be multiples of *increment*.
# However, it ensures that the bounding box extends by at least 0.25 times the
# increment.

fig = pygmt.Figure()
fig.coast(
# Expand the region boundaries to be multiples of 3 degrees in all
# directions
region="JP+e3",
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.show()
Loading

0 comments on commit dcea033

Please sign in to comment.