ggplot特定的粗线 [英] ggplot specific thick line
本文介绍了ggplot特定的粗线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何绘制一条比另一条更粗的线。我尝试使用 geom_line(size = X)
,但这样会增加两行的粗细。假设我想增加第一列的厚度,那么如何能够接近这一点?
How would one be able to plot one line thicker than the other. I tried using the geom_line(size=X)
but then this increases the thickness of both lines. Let say I would like to increase the thickness of the first column, how would one be able to approach this?
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)
推荐答案
您需要将线宽映射到变量:
You need to map line thickness to the variable:
p + geom_line(aes(size = ind))
控制厚度使用 scale_size_manual()
:
To control the thickness use scale_size_manual()
:
p + geom_line(aes(size = ind)) +
scale_size_manual(values = c(0.1, 1))
这篇关于ggplot特定的粗线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文