【发布时间】:2018-01-22 14:40:47
【问题描述】:
我正在尝试使用ggplot 在世界地图中添加白天/夜间线以指示白天和黑夜区域;像这样:
计划是像这样在 24 小时周期内为我的地图制作动画:
上面的动画是使用正弦波实现的,我知道这是完全不准确的。我知道geosphere::gcIntermediate 允许我画大圆线,如下所示:
library(ggplot2)
library(ggthemes)
library(geosphere)
sunPath1 <- data.frame(gcIntermediate(c(-179, -30), c(0, 30), n=100))
sunPath2 <- data.frame(gcIntermediate(c(0, 30), c(179, -30), n=100))
sunPath <- rbind(sunPath1, sunPath2)
ggplot(sunPath) +
borders("world", colour = "gray95", fill = "gray90") +
geom_ribbon(aes(lon, ymax = lat), ymin=-180, fill="black", alpha=0.2) +
theme_map()
虽然我不确定是否可以在一年中的不同时间点绘制所需的线条,例如三月的时候是这样的:
我没有找到解决方案,但我猜我不知道要搜索的关键字,因为这超出了我的知识范围。我认为答案可能在sunrise equation 的某个地方,但我不知道如何应用这些来找到解决方案,也不知道如何在一年中改变这些参数。 This website(用于上图)似乎也很有用,但我还不知道怎么用!
【问题讨论】:
标签: r ggplot2 gis great-circle geosphere