ggplot2 map of Canada with labels, shapefile issue

Hi @lids and welcome!

We don't have a copy your mapdata_AML file, so it's hard to troubleshoot.

What's happening is that your basemap s_census and your locations mapdata_AML are in two different Coordinate Reference Systems (CRS). The s_census data has coordinate system PCS_Lambert_Conformal_Conic (EPSG 3347) (units are in meters), and your mapdata_AML file has longitude and latitude probably in EPSG 4326 (units are in degrees).

You will either have to transform mapdata_AML to match the basemap, or vice versa.

Here's an example using simple features

library("sf")
library("here")
library("ggplot2")

s_census <- st_read(here("data", "lpr_000b16a_e.shp"))
# Projected CRS: PCS_Lambert_Conformal_Conic (EPSG 3347)

map_aml <- st_as_sf(map_aml, coords = c("long", "lat"),
  crs = st_crs(4326)) 

map_aml <- st_transform(map_aml,  crs = 3347)

census_map <- ggplot() +
  geom_sf(s_census) +
  geom_sf(map_aml) +
  coord_sf()
2 Likes