Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c893251
Add draft of JN for backgroundmaps - grdimage and contextily
yvonnefroehlich Dec 24, 2024
2b5b27b
Include output figure
yvonnefroehlich Jan 4, 2025
c7325ea
Follow coding style
yvonnefroehlich Jan 5, 2025
d403d9d
Adjust filename
yvonnefroehlich Jan 5, 2025
e5a95f5
Add land-water map and crustal-age-countor map
yvonnefroehlich Apr 22, 2025
abef33c
Adjust codes
yvonnefroehlich Apr 22, 2025
12f4857
Test other dataset
yvonnefroehlich Apr 23, 2025
0657fdc
Use same study area for all maps
yvonnefroehlich Apr 25, 2025
31c6b38
Add scalebar and use Box class
yvonnefroehlich Oct 11, 2025
354c468
Use subplot mode and add labels | Remove unneeded cells
yvonnefroehlich Oct 14, 2025
f57032a
Remove comments
yvonnefroehlich Oct 15, 2025
4468e4b
Reduce size of panels |Use default of source parameter
yvonnefroehlich Oct 16, 2025
9e0d96e
Revert "Reduce size of panels |Use default of source parameter"
yvonnefroehlich Oct 17, 2025
d3fa667
Add code back
yvonnefroehlich Oct 17, 2025
f4d2666
Remove box for scale
yvonnefroehlich Nov 5, 2025
5fbe7c6
Move to normal python script (temporaly)
yvonnefroehlich Nov 5, 2025
a3a84c8
Use default scale hight
yvonnefroehlich Nov 6, 2025
fc16d69
Download grid bevor setting up basemap
yvonnefroehlich Nov 6, 2025
2c6c174
Set panel by index
yvonnefroehlich Nov 8, 2025
4c992a5
Set resolution to high
yvonnefroehlich Nov 8, 2025
b134bc6
Combine panel b and c, add 3-D map via grdview in panel c
yvonnefroehlich Nov 8, 2025
eac7ddb
Adjust position of panel label
yvonnefroehlich Nov 8, 2025
fc0795b
Merge branch main into background branch
yvonnefroehlich Nov 8, 2025
69a81f7
Use only earth relief dataset, and remove one colorbar
yvonnefroehlich Nov 10, 2025
c5dae58
Reorder panels
yvonnefroehlich Nov 11, 2025
c506096
Use tuple instead of list
yvonnefroehlich Nov 11, 2025
e03ecbd
Use higher resolution of 30s
yvonnefroehlich Nov 11, 2025
68a3e20
Adjust pen of contour lines
yvonnefroehlich Nov 11, 2025
a6b1761
Move colorbar to panel b to fill white space a the right side
yvonnefroehlich Nov 11, 2025
0280660
Add annotations to contour lines
yvonnefroehlich Nov 11, 2025
daf58db
Add shading for 3-D plot, adjust contour lines, reduce horizontal space
yvonnefroehlich Nov 11, 2025
5c9f612
Adjust horizontal space
yvonnefroehlich Nov 11, 2025
64d12ac
Add box behind annotations
yvonnefroehlich Nov 11, 2025
1a2145c
Adjust thickness of contourlines
yvonnefroehlich Nov 11, 2025
c5b1594
Remove coutour lines and use shading for 2-D map
yvonnefroehlich Nov 12, 2025
aad078a
Remove codes for contours
yvonnefroehlich Nov 12, 2025
32fc8dc
Remove comment
yvonnefroehlich Nov 12, 2025
27fabd0
Save output figure
yvonnefroehlich Nov 12, 2025
4729a15
Rename Python script and JN
yvonnefroehlich Nov 12, 2025
3846e42
Reorder panels
yvonnefroehlich Nov 12, 2025
d89bde4
Add shading to colorbar
yvonnefroehlich Nov 13, 2025
4b9b4bc
Update output figure
yvonnefroehlich Nov 13, 2025
6266d14
Add shaing also to 3-D map
yvonnefroehlich Nov 13, 2025
c3d1272
Use default (minimum of elevation) for "plane" parameter
yvonnefroehlich Nov 13, 2025
07bf2ec
Add annotation ever 500 meters
yvonnefroehlich Nov 14, 2025
ca8efe4
Use annotations every 500 and tick every 250 meters
yvonnefroehlich Nov 14, 2025
82d472e
Update output figure
yvonnefroehlich Nov 14, 2025
600fb8b
Merge remote-tracking branch 'origin/main' into fig/backgroundmaps
yvonnefroehlich Nov 16, 2025
25157e1
Remove comment
yvonnefroehlich Nov 27, 2025
bd66675
Adjust order of parameters for writting the text
yvonnefroehlich Nov 27, 2025
4c38d3d
Remove blank line
yvonnefroehlich Nov 27, 2025
a3138b8
Use consistently "gray"
yvonnefroehlich Nov 27, 2025
6b2d62c
Remove blank line
yvonnefroehlich Nov 27, 2025
60f1218
Update output figure
yvonnefroehlich Nov 27, 2025
f90603d
Move 'autolabel' parameter to the end
yvonnefroehlich Nov 27, 2025
6d2200a
Merge remote-tracking branch 'origin/main' into fig/backgroundmaps
yvonnefroehlich Nov 27, 2025
ba6ba57
Merge remote-tracking branch 'origin/main' into fig/backgroundmaps
yvonnefroehlich Nov 27, 2025
ac9ad36
Move codes to JN
yvonnefroehlich Nov 27, 2025
c6034bf
Move codes to JN
yvonnefroehlich Nov 27, 2025
3a175ef
Use MR instead of RM
yvonnefroehlich Nov 28, 2025
aa6d0bb
Reorder parameter for coast
yvonnefroehlich Nov 28, 2025
e3ef58a
Remove execution permission from JN | Remove output PNG
yvonnefroehlich Nov 29, 2025
b74e843
Clear output cells
yvonnefroehlich Nov 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Fig3_PyGMT_backgrounds.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "d57cb626-f006-4a23-950d-c673fd04b840",
"metadata": {},
"outputs": [],
"source": [
"# Copy finale version of script from normal Python file"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Binary file added Fig3_PyGMT_backgrounds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions Fig3_PyGMT_backgrounds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import pygmt

region = [-25, -13, 63.2, 66.7]

fig = pygmt.Figure()
with fig.subplot(
nrows=2,
ncols=2,
subsize=("12c", "8.5c"),
autolabel="(a)+o0.15c/0.3c+gwhite@30+v", # vertical order of labels
margins=("0.3c", "0.2c"),
sharex="b",
sharey="l",
frame="WSrt",
):

# Top left
fig.basemap(region=region, projection="M?", panel=0)
fig.coast(land="gray", water="lightblue", shorelines=True, resolution="high")
fig.basemap(map_scale="n0.86/0.1+c+w100k+f+l")

# Bottom left
fig.tilemap(region=region, projection="M?", zoom=7, panel=1)

# Top right
grd_relief = pygmt.datasets.load_earth_relief(resolution="01m", region=region)
fig.basemap(region=region, projection="M?", panel=2)
fig.grdimage(grid=grd_relief, cmap="SCM/oleron", shading=True)
fig.colorbar(frame=["xa500f250+lElevation", "y+lm"], position="JRM", shading=True)

# Bottom right
fig.basemap(region=region, projection="M?", perspective=(-150, 25), panel=3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the Figure.basemap call here? Or merge it into Figure.grdview.

Actually I'm not sure if the use of region is correct here, since in a 3-D perspective view, region may need six values rather than four.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I testded this locally and for me it looks like that the output figure remains unchanged. I think this can get problematic for Figure.plot3d and six values need to be passed to the region parameter.
I like about using Figure.basemap and Figure.grdview that we can show that for the first method the users has to define the perspective parameter, but for the following methods perspective=True can be used.

fig.grdview(
grid=grd_relief,
cmap="SCM/oleron",
surftype="s",
shading=True,
zsize="1.5c",
plane="+ggrey",
perspective=True,
)

fig.show()
fig.savefig("Fig3_PyGMT_backgrounds.png")