[英]ggplot geom_pointrange: point stroke and range line in different colours
[英]ggplot join line and point plot with conditional colours
dat <- structure(list(yearID = c(2014L, 2015L, 2016L, 2017L, 2018L,
2019L, 2013L), yield = c(0.328575295095694, 0.0853721681507231,
1.26616635028825, 0.609179296764281, 0.519918049485935, 0.77932406868591,
0.94), flag = c("sim", "sim", "sim", "sim", "sim", "sim", "obs"
)), row.names = c(NA, -7L), class = c("tbl_df", "tbl", "data.frame"
))
library(ggplot2)
ggplot(dat, aes(x = yearID, y = yield, col = flag)) +
geom_point() + geom_line() + theme(legend.position = 'top')
如何连接所有点并使用标志列区分它们
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.