我有一个像这样的数据集
COUNTY == c(COUNTY1, COUNTY2, COUNTY3)
PERC_2012 == c(5%, 6%, 12%)
PERC_2017 == c(55%, 67%, 67%)
data.frame(COUNTY, PERC_2012, PERC2017)
如何绘制x =县和perc 2012和2017的单独行? 谢谢
答案 0 :(得分:0)
您是否正在寻找类似的东西?
ggplot(county) +
geom_area(aes(COUNTY, Value, group = PERC, fill = PERC))
COUNTY <- c("COUNTY1", "COUNTY2", "COUNTY3")
PERC_2012 <- c(.05, .06, .12)
PERC_2017 <- c(.55, .67, .67)
county <- data.frame(COUNTY, PERC_2012, PERC_2017)
library(dplyr)
county <- county %>%
gather("PERC", "Value", -COUNTY)