Thick line ggplot

How can you build one line thicker than another. I tried using geom_line(size=X) , but then this increases the thickness of both lines. Say, I would like to increase the thickness of the first column, how could I 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) 
+6
source share
1 answer

You need to match the thickness of the string to a 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

+13
source

Source: https://habr.com/ru/post/950824/


All Articles