我有一个这样的数据框
Data2 <- structure(list(year = c(2008L, 2009L, 2010L, 2011L, 2012L, 2013L,
2014L, 2015L, 2016L, 2017L, 2018L, 2019L, 2008L, 2009L, 2010L,
2011L, 2012L, 2013L, 2014L, 2015L, 2016L, 2017L, 2018L, 2019L,
2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2016L,
2017L, 2018L, 2019L), variable = c("Yahoo", "Yahoo", "Yahoo",
"Yahoo", "Yahoo", "Yahoo", "Yahoo", "Yahoo", "Yahoo", "Yahoo",
"Yahoo", "Yahoo", "Amazon", "Amazon", "Amazon", "Amazon", "Amazon",
"Amazon", "Amazon", "Amazon", "Amazon", "Amazon", "Amazon", "Amazon",
"Google", "Google", "Google", "Google", "Google", "Google", "Google",
"Google", "Google", "Google", "Google", "Google"), value = c(1L,
0L, 0L, 0L, 1L, 1L, 3L, 4L, 3L, 10L, 9L, 0L, 0L, 1L, 0L, 0L,
3L, 2L, 2L, 3L, 8L, 9L, 12L, 3L, 0L, 0L, 0L, 0L, 0L, 1L, 1L,
0L, 1L, 2L, 4L, 0L)), class = "data.frame", row.names = c(NA,
-36L))
,我想用这个来绘制它:
library(ggplot2)
ggplot(Data2, aes(year, variable, size = value, color = variable)) +
geom_point()
然而,该图的问题在于x轴例如没有2007,但它有2007.5,气泡不在对称位置
我该如何解决?