library(tidyverse)
library(showtext)
font_add_google(name = 'Georama',
family = 'Georama')
showtext_auto()
<- marmap::getNOAA.bathy(lon1 = -180, lon2 = 180,
bathy lat1 = -90, lat2 = 90,
res = 15, keep = TRUE,
antimeridian=TRUE)
<- marmap::as.SpatialGridDataFrame(bathy)
sp_grid sp_grid
Plot it with ggplot2 with an ortho projection
<- as.data.frame(sp_grid) %>%
df rename(lon=s1, lat=s2)
<- df %>%
df_sf ::st_as_sf(coords = c("lon", "lat"),
sfcrs = 4326) %>%
::st_transform(crs = "+proj=ortho")
sf df_sf
<- rnaturalearth::ne_countries(scale = "medium",
world returnclass = "sf") %>%
::st_transform(crs = "+proj=ortho") sf
ggplot() +
geom_sf(data = df_sf,
aes(color = layer),
show.legend = F)+
geom_sf(data = world ,
fill = "red",
color = NA) +
coord_sf() +
labs(title = "The Blue Planet",
subtitle = "Bathymetry",
caption = "Data: marmap::getNOAA.bathy\n#30DayMapChallenge Day28 | @fgazzelloni") +
theme_void() +
theme(text = element_text(family = "Georama", size =40),
plot.title = element_text(hjust = 0.5, size = 60),
plot.subtitle = element_text(hjust = 0.5, size = 40),
plot.caption = element_text(hjust = 0.5, size=20,
lineheight=0.8))
ggsave("day28_the_blue_planet.png",
bg = "white",
width = 8, height = 8,
units = "cm")