![](/img/trans.png)
[英]Create space and a vertical line between categories using geom_bar plot in ggplot2 in R
[英]R ggplot2 reduce space between categories in line plot
我有以下数据:
Name Value Type
One 500 Confirmed
One 1000 Total
Two 550 Confirmed
Two 900 Total
Three 550 Confirmed
Three 800 Total
和以下R脚本:
#!/usr/bin/env Rscript
library(ggplot2)
data = structure(list(Name = c("One", "One", "Two", "Two", "Three",
"Three"), Value = c(500L, 1000L, 550L, 900L, 550L, 800L), Type = c("Confirmed",
"Total", "Confirmed", "Total", "Confirmed", "Total")), .Names = c("Name",
"Value", "Type"), class = "data.frame", row.names = c(NA, -6L
))
ggplot(data=data, aes(x=Value, y=Name, group=Name, colour=Type)) + geom_line(color="black") + geom_point()
产生以下图:
我的问题是,如何减少三个类别(一,二,三)之间的垂直空间? 他们似乎不必要地相距遥远。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.