I am trying to make a map to indicate my research site. I managed to plot a basemap of the Barents Sea and indicate my research site with a red dot. Now I would like to add the country names "Svalbard" and "Norway", add "Barents sea" and the name of my research site "Hopen Deep". The only warning I get is: "Assuming crs = 4326 in stat_spatial_identity()". I have tried several suggestions but never seem to be able to plot the labels. They simply do not show up. Any idea of how I could fix this?
The code looks like this:
library(ggplot2)
library(ggOceanMaps)
library(ggspatial) #for data plotting
#MAP OF SVALBARD/NORWAY WITH HIGHLIGHTED HOPENDEEP SITE
dt <- data.frame(lon = 31.5, lat = 75.2) #N, E coordinates research site
# Create a data frame for labels
labels <- data.frame(
location = c("Norway", "Svalbard", "Barents Sea", "Hopen Deep"),
lon = c(10, 20, 30, 31.5),
lat = c(60, 78, 75, 75.2)
)
basemap(limits = c(15, 40, 70, 80), bathymetry = TRUE, rotate = TRUE) + #rotate = TRUE rotates the map northward (straight)
geom_text(data = labels, aes(x = lon, y = lat, label = location), color = "black", size = 10, nudge_y = -0.2) +
ggspatial::geom_spatial_point(data = dt, aes(x = lon, y = lat), color = "red")
I tried it with annotate, re-ordering layers, geom_label but this al did not seem to work. The labels simply do not show up. Anyone has any idea of what I am missing?
The problem is that the map data's co-ordinate reference system appears to be ESPG:3995, which are Northings/Eastings co-ordinates relative to a point halfway between Svalbard and Greenland. This is then further confounded by the
rotate = TRUE. You could convert your chosen co-ordinates to the same CRS usingsf: