Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ggplot specific thick line

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)
like image 944
user1234440 Avatar asked Aug 01 '13 14:08

user1234440


1 Answers

You need to map line thickness to the variable:

p + geom_line(aes(size = ind))

enter image description here

To control the thickness use scale_size_manual():

p + geom_line(aes(size = ind)) +
  scale_size_manual(values = c(0.1, 1))

enter image description here

like image 127
alexwhan Avatar answered Sep 29 '22 14:09

alexwhan