我需要在南极洲地图上绘制一些数据,我设法按照这个线程这样做
library(rgdal)
library(raster)
library(ggplot2)
Long <- c(-75, -76, -77, -78, -79)
Lat <- c(123, 124, 125, 126, 127)
Sodio<- c(110, 209, 65.7, 47.6, 135)
data<-data.frame(Long, Lat, Sodio)
# Defines the x axes required
x_lines <- seq(-120,180, by = 60)
wm <- map_data("world")
ggplot() +
geom_polygon(data = wm, aes(x = long, y = lat, group = group), fill = "grey", colour = "black", alpha = 0.8) +
# Convert to polar coordinates
coord_map("ortho", orientation = c(-90, 0, 0)) +
scale_y_continuous(limits=c(-90,-60),breaks = seq(-45, -90, by = -5), labels = NULL) +
# Removes Axes and labels
scale_x_continuous(breaks = NULL) +
xlab("") +
ylab("") +
# Adds labels
geom_text(aes(x = -160, y = seq(-55, -85, by = -10), hjust = -0.2, label = paste0(seq(55, 85, by = 10), "°S"))) +
geom_text(aes(x = x_lines, y = -63, label = c("120°W", "60°W", "0°", "60°E", "120°E", "180°W"))) +
# Adds axes
geom_hline(aes(yintercept = -60), size = 1) +
geom_segment(aes(y = -60, yend = -90, x = x_lines, xend = x_lines), linetype = "dashed") +
# Change theme to remove axes and ticks
theme(panel.background = element_blank(),
panel.grid.major = element_line(size = 0.25, linetype = 'dashed',
colour = "black"),
axis.ticks=element_blank()) +
geom_point(data=data, aes(x=Long, y=Lat, color=Sodio))+
scale_color_gradient(low="blue", high="red")
并且代码有效。就像对原始用户的魅力和赞许一样,发布它,因为它帮助了我很多。问题是,由于所有数据都在一个小扇区中(主要在 85° 和 65°N 之间以及 180°W 和 130°W 之间,我发布的只是一个超短的虚拟集)我试图只绘制南极大陆的那个“楔子”,以帮助我更清楚地可视化数据。我可以解释情节并用 Photoshop 剪切它,但我需要绘制其中的一些。
我尝试将投影更改为圆锥投影,但它开始做......非常奇怪的事情,比如试图对整个世界进行投影,即使我尝试在 scale_y_continuous 中设置限制。
关于如何解决这个问题的任何想法?另外,关于如何在地图上添加“海拔”线的任何想法?我在 ggplot 工作,因为之后我需要在上面绘制一些数据,而且我更熟悉 R 包,但我可以使用其他包,只要它们允许我在上面绘制数据它,他们可以以 300 dpi 保存情节......