use*_*440 6 graphics plot r ggplot2
如何能够绘制比另一条更粗的一条线.我尝试使用geom_line(size=X)但是这会增加两条线的厚度.假设我想增加第一列的厚度,怎么能够接近这个?
a <- (cbind(rnorm(100),rnorm(100))) #nav[,1:10]
sa <- stack(as.data.frame(a))
sa$x <- rep(seq_len(nrow(a)), ncol(a))
require("ggplot2")
p<-qplot(x, values, data = sa, group = ind, colour = ind, geom = "line")
p + theme(legend.position = "none")+ylab("Millions")+xlab("Age")+
geom_line( size = 1.5)
Run Code Online (Sandbox Code Playgroud)
ale*_*han 14
您需要将线条粗细映射到变量:
p + geom_line(aes(size = ind))
Run Code Online (Sandbox Code Playgroud)

要控制厚度使用scale_size_manual():
p + geom_line(aes(size = ind)) +
scale_size_manual(values = c(0.1, 1))
Run Code Online (Sandbox Code Playgroud)
