在月中获取不均匀分布的 geom_points 的 geom_line 值
我需要在每月 15 日从使用下面的可重现示例创建的几何线中获取值。原始几何点的每月日期取决于数据收集日。感谢任何可能的帮助
Value <- c(19.14104, 11.72115, 9.66083, 10.99109, 13.65047, 10.10627, 13.53027, 18.25272, 25.57741)
Dates <- c("07/11/19", "28/11/19", "16/12/19", "10/01/20", "21/01/20", "03/02/20", "04/03/20", "19/03/20", "20/05/20")
df <- data.frame(Value, Dates)
View(df)
df$Dates <- lubridate::dmy(df$Dates)
gpp_plot <- ggplot() +
geom_point(data = df, aes(x=Dates, y=Value), alpha=0.5) +
geom_line(data = df, aes(x=Dates, y=Value), alpha=0.5) +
theme(axis.text.y=element_text(size=10),
axis.title=element_text(size=10, , face = "bold"),
axis.text.x = element_text(size=10, face = "bold", angle = 45, vjust = 0.5))+
xlab('') +
ylab('LI-7810_FCH4_DRY_[nmol+1m-2s-1]') +
scale_x_date(date_labels = "%b %y",breaks = "1 months") +
theme(legend.position="none")
gpp_plot
I need to obtain value at 15th of every month from the geom line created using the reproducible example below. The original geom points are at varied monthly dates depending on data collection days. Appreciate any help possible
Value <- c(19.14104, 11.72115, 9.66083, 10.99109, 13.65047, 10.10627, 13.53027, 18.25272, 25.57741)
Dates <- c("07/11/19", "28/11/19", "16/12/19", "10/01/20", "21/01/20", "03/02/20", "04/03/20", "19/03/20", "20/05/20")
df <- data.frame(Value, Dates)
View(df)
df$Dates <- lubridate::dmy(df$Dates)
gpp_plot <- ggplot() +
geom_point(data = df, aes(x=Dates, y=Value), alpha=0.5) +
geom_line(data = df, aes(x=Dates, y=Value), alpha=0.5) +
theme(axis.text.y=element_text(size=10),
axis.title=element_text(size=10, , face = "bold"),
axis.text.x = element_text(size=10, face = "bold", angle = 45, vjust = 0.5))+
xlab('') +
ylab('LI-7810_FCH4_DRY_[nmol+1m-2s-1]') +
scale_x_date(date_labels = "%b %y",breaks = "1 months") +
theme(legend.position="none")
gpp_plot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如评论中所建议的,您可以
近似
新日期的值
:As suggested in comments, you could
approx
theValue
at new dates: