我的代码:
library("ggplot2")
library("sf")
library("rnaturalearth")
library("rnaturalearthdata")
library("ggspatial")
chesapeake_bay <- ne_countries(scale = "medium", returnclass = "sf")
plot<-ggplot(data = chesapeake_bay) +geom_sf(fill="darkgreen") + coord_sf(xlim = c(-77.5, -75), ylim = c(37, 40),expand = TRUE)+
xlab("Longitude") + ylab("Latitude") + ggtitle("Chesapeake Bay")+
theme(panel.background = element_rect(fill = "lightblue")) +
annotate(geom = "text",x = -76.1,y = 37.8,label = "Chesapeake Bay",color = "brown",size = 3, angle=90) +
annotation_north_arrow(location = "tl",pad_x = unit(0.5, "cm"),pad_y = unit(1, "cm"),height=unit(1,"cm"),width=unit(0.5,"cm")) +
theme(panel.grid.major = element_line(linetype = "dashed", size = 0.2))
这段代码应该生成切萨皮克湾的地图,但是当我运行它时,它不会产生任何东西。