Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f781946
Add draft of JN for geopandas - geodataframes with lines and polygons
yvonnefroehlich Dec 24, 2024
93afa24
Include output figure
yvonnefroehlich Jan 4, 2025
587da3a
Reduce resolution of output image in JN
yvonnefroehlich Jan 4, 2025
fc103e9
Follow coding style
yvonnefroehlich Jan 5, 2025
57511d0
Adjust filename
yvonnefroehlich Jan 5, 2025
01812e8
Remove comments | Improve code structure
yvonnefroehlich Oct 16, 2025
e288455
Move to normal python script (temporaly)
yvonnefroehlich Nov 5, 2025
fb445fd
Rename files and save output figure
yvonnefroehlich Nov 12, 2025
6c58129
Add codes for choropleth map based on dcw parameter
yvonnefroehlich Nov 13, 2025
0e321e0
Merge remote-tracking branch 'origin/main' into fig/geopandas
yvonnefroehlich Nov 16, 2025
c885c52
Add code for example covering points, lines, and polygons
yvonnefroehlich Nov 19, 2025
ab2ca00
Remove code for chorophleth via dcw
yvonnefroehlich Nov 19, 2025
c6a39c1
Remove unneeded files
yvonnefroehlich Nov 19, 2025
65c458b
Adjust codes for example with natural earth data | temporly focus on …
yvonnefroehlich Nov 20, 2025
012e5fb
Test different regions
yvonnefroehlich Nov 21, 2025
8cb2e58
Remove content for Cicago example
yvonnefroehlich Nov 21, 2025
af55d14
Change scaling to e-6
yvonnefroehlich Nov 21, 2025
7042382
Use 1e-6
yvonnefroehlich Nov 21, 2025
40f4390
Adjust figure number
yvonnefroehlich Nov 21, 2025
dd18459
Adjust color and remove unneeded pen color
yvonnefroehlich Nov 21, 2025
80a0648
Focus on Africa
yvonnefroehlich Nov 21, 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 Fig6_PyGMT_geopandas.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "760146f6-d4c9-4e69-b539-f42e057c7945",
"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 Fig6_PyGMT_geopandas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions Fig6_PyGMT_geopandas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pygmt
import geopandas as gpd

world = gpd.read_file("https://naciscdn.org/naturalearth/50m/cultural/ne_50m_admin_0_countries.zip")
world["POP_EST"] *= 1e-6
rivers = gpd.read_file("https://naciscdn.org/naturalearth/110m/physical/ne_110m_rivers_lake_centerlines.zip")
cities = gpd.read_file("https://naciscdn.org/naturalearth/110m/cultural/ne_110m_populated_places_simple.zip")
cities_world = cities[cities["worldcity"]==1] # Focus on large cities

fig = pygmt.Figure()
fig.basemap(region=[-19.5, 53, -38, 37.5], projection="M15c", frame=True)
pygmt.makecpt(cmap="bilbao", series=(0, 270, 10))
fig.plot(
data=world[["POP_EST", "geometry"]],
pen="1p,gray50",
fill="+z",
cmap=True,
aspatial="Z=POP_EST",
)
fig.colorbar(frame="x+lPopulation (millions)")
fig.plot(data=rivers["geometry"], pen="1.5p,darkblue")
fig.plot(data=cities["geometry"], style="s0.25c", fill="darkorange", pen="1p")
fig.text(
x=cities_world.geometry.x,
y=cities_world.geometry.y,
text=cities_world["name"],
font="10p,Helvetica-Bold",
offset="0c/-0.25c",
justify="TR",
fill="white@30",
)
fig.show()
fig.savefig(fname="Fig6_PyGMT_geopandas.png")