Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Map Arctic/subarctic regions in ggplot2 with Lambert Conformal Conic projection in R

$
0
0

I am trying to map lat/lon locations in the Arctic/subarctic region using ggplot2, and colour them by type.

Here are the packages I'm using:

library(ggplot2)
library(rgdal)
library(ggmap)
library(sp)
library(dplyr) 
library(ggspatial) #To use geom_sf to add shapefiles

Here is an example of my data:

dat <- data.frame(
  "Lat" =  c("70.5","74.5","58.5","60.5"), 
  "Lon" = c("-21.5","19.0","-161.5","-147.5"), 
  "Type"=c("A","B","A","B")
)
dat

I created a shapefile for the Arctic circle, found here: https://www.arcgis.com/home/item.html?id=f710b74427a14a1d804e90fbf94baed4

ArcticCircle <- sf::st_read("C:/.../LCC_AC.shp")

I am trying to map this in ggplot2, but I can't find a way to add a basemap with the Lambert Conformal Conic projection.

I know you can use coord_sf() to specify projection and boundaries, but I can't find a code for a conic projection.

p <- ggplot()+
geom_point(data = dat, aes(x = Lon, y = Lat, colour = Type))+
geom_sf(data = ArcticCircle, linetype = "dashed", aes())+
xlab("Longitude")+
ylab("Latitude")+
p

My map boundary would preferably be a circle around the Arctic circle at about 45 degrees latitude. If making a circle boundary isn't possible, a rectangle around that latitude it would work as well.

I am relatively new to R, so any help would be appreciated!


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>