Skip to content

Commit dd3e077

Browse files
Deploy dev from 0bb6ba6
1 parent b92ca53 commit dd3e077

1,218 files changed

Lines changed: 20375 additions & 7576 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dev/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 23e71cd08fd2d8733d1f6542a035c04a
3+
config: fee4d3d74cbf90e5594aedcecb3fd75c
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

dev/_downloads/004f6d23a04369ca0db9c83de3b6182d/scalebar.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"\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\n :doc:`2-character justification code </techref/justification_codes>`.\n Lower / uppercase **j** / **J** mean inside / outside of the map\n 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\n :doc:`2-character justification code </techref/justification_codes>`.\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"
7+
"\n# Scale bar\n\nThe :meth:`pygmt.Figure.scalebar` method can be used to add a scale bar to a map. This\nexample shows how such a scale bar can be customized.\n"
88
]
99
},
1010
{
@@ -15,14 +15,14 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"import pygmt\nfrom pygmt.params import Box\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()"
18+
"import pygmt\nfrom pygmt.params import Axis, Box, Frame, Position\n\n# Create a new Figure instance\nfig = pygmt.Figure()\n\n# Mercator projection with 10 centimeters width\nfig.basemap(\n region=[-45, -25, -15, 0],\n projection=\"M0/0/10c\",\n frame=Frame(axes=\"WSne\", axis=Axis(annot=True, tick=True)),\n)\n\n# --- Top Left: Add a plain scale bar ---\n# It is placed based on geographic coordinates 42\u00b0 West and 1\u00b0 South, applies at the\n# reference point by default, and represents a length of 500 kilometers.\nfig.scalebar(length=\"500k\", position=Position((-42, -1), cstype=\"mapcoords\"))\n\n# --- Top Right: Add a fancy scale bar ---\n# It is placed based on normalized bounding box coordinates. Use a fancy style to get a\n# scale bar that looks like train tracks. Add the distance unit to the single distance\n# values.\nfig.scalebar(\n position=Position((0.8, 0.95), cstype=\"boxcoords\"),\n length=\"500k\",\n fancy=True,\n unit=True,\n)\n\n# --- Bottom Left: Add a thick scale bar ---\n# It applies at the middle of the map (scale_loc is set to True). Use the height\n# parameter to adjust the thickness of the scale bar Without providing text, the label\n# parameter adds the distance unit as label.\nfig.scalebar(\n position=Position((0.2, 0.15), cstype=\"boxcoords\"),\n scale_loc=True,\n length=\"500k\",\n height=\"10p\",\n fancy=True,\n label=True,\n)\n\n# --- Bottom Right: Add a scale bar valid for a specific location ---\n# It is placed at BottomRight using MiddleRight as anchor point with an offset of 1\n# centimeter in both x- and y-directions. It applies at -7\u00b0 South. A customized label\n# is added via the label parameter.\nfig.scalebar(\n position=Position(\"BR\", anchor=\"MR\", offset=1),\n scale_loc=-7,\n length=\"500k\",\n fancy=True,\n unit=True,\n label=\"valid at 7\u00b0 S\",\n)\n\nfig.show()"
1919
]
2020
},
2121
{
2222
"cell_type": "markdown",
2323
"metadata": {},
2424
"source": [
25-
"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"
25+
"The ``box`` parameter allows surrounding the scale bar. This can be useful when adding\na scale bar to a colorful map to improve contrast and readability.\n\n"
2626
]
2727
},
2828
{
@@ -33,7 +33,7 @@
3333
},
3434
"outputs": [],
3535
"source": [
36-
"# 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=Box(fill=\"white@30\", pen=\"0.5p,gray30,solid\", radius=\"3p\"),\n)\n\nfig.show()"
36+
"fig = pygmt.Figure()\n\nfig.basemap(\n region=[-45, -25, -15, 0],\n projection=\"M10c\",\n frame=Frame(axes=\"WSne\", axis=Axis(annot=True, tick=True)),\n)\nfig.coast(land=\"tan\", water=\"steelblue\")\nfig.scalebar(\n position=Position(\"BL\", cstype=\"inside\", offset=1),\n scale_loc=-7,\n length=\"500k\",\n fancy=True,\n label=\"km\",\n label_alignment=\"right\",\n # Fill the box in white with a transparency of 30 percent, add a solid outline in\n # darkgray (gray30) with a thickness of 0.5 points, and use rounded edges with a\n # radius of 3 points\n box=Box(fill=\"white@30\", pen=\"0.5p,gray30,solid\", radius=\"3p\"),\n)\n\nfig.show()"
3737
]
3838
}
3939
],
@@ -53,7 +53,7 @@
5353
"name": "python",
5454
"nbconvert_exporter": "python",
5555
"pygments_lexer": "ipython3",
56-
"version": "3.14.2"
56+
"version": "3.14.3"
5757
}
5858
},
5959
"nbformat": 4,

dev/_downloads/020a0d3a1bf85b03399dbd49671e6702/regions.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# %%
1111
import pygmt
12+
from pygmt.params import Axis
1213

1314
# %%
1415
# Coordinates
@@ -32,7 +33,7 @@
3233
# Display the shorelines and set the pen thickness to 0.5p
3334
shorelines="1/0.5p",
3435
# Set the frame to display annotations and gridlines
35-
frame="ag",
36+
frame=Axis(annot=True, grid=True),
3637
)
3738
fig.show()
3839

@@ -49,7 +50,7 @@
4950
water="white",
5051
borders="1/0.5p",
5152
shorelines="1/0.5p",
52-
frame="ag",
53+
frame=Axis(annot=True, grid=True),
5354
)
5455
fig.show()
5556

@@ -69,7 +70,7 @@
6970
water="white",
7071
borders="1/0.5p",
7172
shorelines="1/0.5p",
72-
frame="ag",
73+
frame=Axis(annot=True, grid=True),
7374
)
7475
fig.show()
7576

@@ -93,7 +94,7 @@
9394
water="white",
9495
borders="1/0.5p",
9596
shorelines="1/0.5p",
96-
frame="ag",
97+
frame=Axis(annot=True, grid=True),
9798
)
9899
fig.show()
99100

@@ -111,7 +112,7 @@
111112
water="white",
112113
borders="1/0.5p",
113114
shorelines="1/0.5p",
114-
frame="ag",
115+
frame=Axis(annot=True, grid=True),
115116
)
116117
fig.show()
117118

@@ -133,7 +134,7 @@
133134
water="white",
134135
borders="1/0.5p",
135136
shorelines="1/0.5p",
136-
frame="ag",
137+
frame=Axis(annot=True, grid=True),
137138
)
138139
fig.show()
139140

@@ -154,7 +155,7 @@
154155
water="white",
155156
borders="1/0.5p",
156157
shorelines="1/0.5p",
157-
frame="ag",
158+
frame=Axis(annot=True, grid=True),
158159
)
159160
fig.show()
160161

@@ -173,7 +174,7 @@
173174
water="white",
174175
borders="1/0.5p",
175176
shorelines="1/0.5p",
176-
frame="ag",
177+
frame=Axis(annot=True, grid=True),
177178
)
178179
fig.show()
179180

@@ -193,7 +194,7 @@
193194
water="white",
194195
borders="1/0.5p",
195196
shorelines="1/0.5p",
196-
frame="ag",
197+
frame=Axis(annot=True, grid=True),
197198
)
198199
fig.show()
199200

@@ -211,7 +212,7 @@
211212
water="white",
212213
borders="1/0.5p",
213214
shorelines="1/0.5p",
214-
frame="ag",
215+
frame=Axis(annot=True, grid=True),
215216
)
216217
fig.show()
217218

@@ -231,6 +232,6 @@
231232
water="white",
232233
borders="1/0.5p",
233234
shorelines="1/0.5p",
234-
frame="ag",
235+
frame=Axis(annot=True, grid=True),
235236
)
236237
fig.show()

dev/_downloads/043329be3aeb3845416fed7987596202/tilemaps.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"import contextily\nimport pygmt\n\nfig = pygmt.Figure()\nfig.tilemap(\n region=[-157.84, -157.8, 21.255, 21.285],\n projection=\"M12c\",\n # Set level of details (0-22)\n # Higher levels mean a zoom level closer to the Earth's\n # surface with more tiles covering a smaller\n # geographic area and thus more details and vice versa\n # Please note, not all zoom levels are always available\n zoom=14,\n # Use tiles from OpenStreetMap tile server\n source=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\",\n frame=\"afg\",\n)\n\nfig.show()"
18+
"import contextily\nimport pygmt\nfrom pygmt.params import Axis\n\nfig = pygmt.Figure()\nfig.tilemap(\n region=[-157.84, -157.8, 21.255, 21.285],\n projection=\"M12c\",\n # Set level of details (0-22)\n # Higher levels mean a zoom level closer to the Earth's\n # surface with more tiles covering a smaller\n # geographic area and thus more details and vice versa\n # Please note, not all zoom levels are always available\n zoom=14,\n # Use tiles from OpenStreetMap tile server\n source=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\",\n frame=Axis(annot=True, tick=True, grid=True),\n)\n\nfig.show()"
1919
]
2020
},
2121
{
@@ -33,7 +33,7 @@
3333
},
3434
"outputs": [],
3535
"source": [
36-
"fig = pygmt.Figure()\nfig.tilemap(\n region=[-157.84, -157.8, 21.255, 21.285],\n projection=\"M12c\",\n # Use the CartoDB Positron option from contextily\n source=contextily.providers.CartoDB.Positron,\n frame=\"afg\",\n)\n\nfig.show()"
36+
"fig = pygmt.Figure()\nfig.tilemap(\n region=[-157.84, -157.8, 21.255, 21.285],\n projection=\"M12c\",\n # Use the CartoDB Positron option from contextily\n source=contextily.providers.CartoDB.Positron,\n frame=Axis(annot=True, tick=True, grid=True),\n)\n\nfig.show()"
3737
]
3838
}
3939
],
@@ -53,7 +53,7 @@
5353
"name": "python",
5454
"nbconvert_exporter": "python",
5555
"pygments_lexer": "ipython3",
56-
"version": "3.14.2"
56+
"version": "3.14.3"
5757
}
5858
},
5959
"nbformat": 4,

dev/_downloads/04a27f4ee668c7dfab99171293a9b062/02_contour_map.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# %%
1212
import pygmt
13+
from pygmt.params import Axis
1314

1415
# %%
1516
# Loading the Earth relief dataset
@@ -43,7 +44,7 @@
4344
# "oleron" is used; a full list of CPTs can be found at :gmt-docs:`reference/cpts.html`.
4445

4546
fig = pygmt.Figure()
46-
fig.grdimage(grid=grid, frame="a", projection="M10c", cmap="SCM/oleron")
47+
fig.grdimage(grid=grid, frame=Axis(annot=True), projection="M10c", cmap="SCM/oleron")
4748
fig.show()
4849

4950

@@ -54,18 +55,17 @@
5455
# To show how the plotted colors relate to the Earth relief, a colorbar can be added
5556
# using the :meth:`pygmt.Figure.colorbar` method.
5657
#
57-
# To control the annotation and labels on the colorbar, a list is passed to the
58-
# ``frame`` parameter. The value beginning with ``"a"`` sets the interval for the
59-
# annotation on the colorbar, in this case every 1,000 meters. To set the label for an
60-
# axis on the colorbar, the argument begins with either ``"x+l"`` (x-axis) or ``"y+l"``
61-
# (y-axis), followed by the intended label.
58+
# To control the annotation and labels on the colorbar, use the ``annot`` parameter to
59+
# set the annotation interval (in this case every 1,000 meters), the ``label`` and
60+
# ``unit``parameters to set the labels along the long and short dimensions of the
61+
# colorbar, respectively.
6262
#
6363
# By default, the CPT for the colorbar is the same as the one set in
6464
# :meth:`pygmt.Figure.grdimage`.
6565

6666
fig = pygmt.Figure()
67-
fig.grdimage(grid=grid, frame="a", projection="M10c", cmap="SCM/oleron")
68-
fig.colorbar(frame=["a1000", "x+lElevation", "y+lm"])
67+
fig.grdimage(grid=grid, frame=Axis(annot=True), projection="M10c", cmap="SCM/oleron")
68+
fig.colorbar(annot=1000, label="Elevation", unit="m")
6969
fig.show()
7070

7171

@@ -85,9 +85,9 @@
8585
# lines can be adjusted (separately) by specifying the desired ``pen``.
8686

8787
fig = pygmt.Figure()
88-
fig.grdimage(grid=grid, frame="a", projection="M10c", cmap="SCM/oleron")
88+
fig.grdimage(grid=grid, frame=Axis(annot=True), projection="M10c", cmap="SCM/oleron")
8989
fig.grdcontour(grid=grid, levels=500, annotation=1000)
90-
fig.colorbar(frame=["a1000", "x+lElevation", "y+lm"])
90+
fig.colorbar(annot=1000, label="Elevation", unit="m")
9191
fig.show()
9292

9393

@@ -100,10 +100,10 @@
100100
# the ``shorelines`` parameter draws a border around the islands.
101101

102102
fig = pygmt.Figure()
103-
fig.grdimage(grid=grid, frame="a", projection="M10c", cmap="SCM/oleron")
103+
fig.grdimage(grid=grid, frame=Axis(annot=True), projection="M10c", cmap="SCM/oleron")
104104
fig.grdcontour(grid=grid, levels=500, annotation=1000)
105105
fig.coast(shorelines="2p", land="lightgray")
106-
fig.colorbar(frame=["a1000", "x+lElevation", "y+lm"])
106+
fig.colorbar(annot=1000, label="Elevation", unit="m")
107107
fig.show()
108108

109109

dev/_downloads/04ea079531b896097081b26e6faf512b/cartesian_histograms.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
"name": "python",
187187
"nbconvert_exporter": "python",
188188
"pygments_lexer": "ipython3",
189-
"version": "3.14.2"
189+
"version": "3.14.3"
190190
}
191191
},
192192
"nbformat": 4,

dev/_downloads/0511f0ea20672dfb94a45be5bdc7a003/linestrings.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"import geopandas as gpd\nimport pygmt\n\n# Read a sample dataset provided by Natural Earth. The dataset contains rivers stored\n# as LineString/MultiLineString geometry types. Here will focus on Asia.\nprovider = \"https://naciscdn.org/naturalearth\"\nrivers = gpd.read_file(f\"{provider}/50m/physical/ne_50m_rivers_lake_centerlines.zip\")\nrivers_asia = rivers.cx[57:125, 7:47].copy()\n\nfig = pygmt.Figure()\nfig.basemap(region=[57, 125, 7, 47], projection=\"M10c\", frame=True)\nfig.coast(land=\"gray95\", shorelines=\"1/0.3p,gray50\")\n\n# Add rivers to map\nfig.plot(data=rivers_asia, pen=\"1p,steelblue\")\n\nfig.show()"
18+
"import geopandas\nimport pygmt\n\n# Read a sample dataset provided by Natural Earth. The dataset contains rivers stored\n# as LineString/MultiLineString geometry types. Here will focus on Asia.\nprovider = \"https://naciscdn.org/naturalearth\"\nrivers = geopandas.read_file(\n f\"{provider}/50m/physical/ne_50m_rivers_lake_centerlines.zip\"\n)\nrivers_asia = rivers.cx[57:125, 7:47].copy()\n\nfig = pygmt.Figure()\nfig.basemap(region=[57, 125, 7, 47], projection=\"M10c\", frame=True)\nfig.coast(land=\"gray95\", shorelines=\"1/0.3p,gray50\")\n\n# Add rivers to map\nfig.plot(data=rivers_asia, pen=\"1p,steelblue\")\n\nfig.show()"
1919
]
2020
}
2121
],
@@ -35,7 +35,7 @@
3535
"name": "python",
3636
"nbconvert_exporter": "python",
3737
"pygments_lexer": "ipython3",
38-
"version": "3.14.2"
38+
"version": "3.14.3"
3939
}
4040
},
4141
"nbformat": 4,

dev/_downloads/06138b8ef0f348c8ea4ec7ea6cd766b0/azim_general_perspective.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"import pygmt\n\nfig = pygmt.Figure()\nfig.coast(\n region=\"g\",\n projection=\"G4/52/12c+a30+t45+v60/60+w0+z250\",\n frame=\"afg\",\n land=\"khaki\",\n water=\"white\",\n)\nfig.show()"
18+
"import pygmt\nfrom pygmt.params import Axis\n\nfig = pygmt.Figure()\nfig.coast(\n region=\"g\",\n projection=\"G4/52/12c+a30+t45+v60/60+w0+z250\",\n frame=Axis(annot=True, tick=True, grid=True),\n land=\"khaki\",\n water=\"white\",\n)\nfig.show()"
1919
]
2020
}
2121
],
@@ -35,7 +35,7 @@
3535
"name": "python",
3636
"nbconvert_exporter": "python",
3737
"pygments_lexer": "ipython3",
38-
"version": "3.14.2"
38+
"version": "3.14.3"
3939
}
4040
},
4141
"nbformat": 4,

dev/_downloads/0727c24f87fbaf3990ceff4f49599878/text_formatting.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"name": "python",
3636
"nbconvert_exporter": "python",
3737
"pygments_lexer": "ipython3",
38-
"version": "3.14.2"
38+
"version": "3.14.3"
3939
}
4040
},
4141
"nbformat": 4,

dev/_downloads/07c438f7ea67f18fb2ae785888e59cda/cartesian_logarithmic.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"name": "python",
3636
"nbconvert_exporter": "python",
3737
"pygments_lexer": "ipython3",
38-
"version": "3.14.2"
38+
"version": "3.14.3"
3939
}
4040
},
4141
"nbformat": 4,

0 commit comments

Comments
 (0)