Re: [R] to change the size of the line in the plot created in ggplot2

2015-12-25 Thread Jeff Newmiller
Giorgio... beware of using cbind to form data frames from vectors. It is inefficient in use of memory, doesn't set column names, and will convert all columns to character if you do it with any vector columns that are of character type. Below are three revamps of this example. Using cbind with

Re: [R] to change the size of the line in the plot created in ggplot2

2015-12-25 Thread Giorgio Garziano
Hi Marna, here is another example that should appear more similar to your scenario than my previous one. x <- seq(1:100) y1 <- x*x g1 <- rep("y1", 100) df1 <- as.data.frame(cbind(x, y1), stringsAsFactors=FALSE) df1 <- as.data.frame(cbind(df1, g1)) colnames(df1)<- c("x", "value", "variable") y2

Re: [R] to change the size of the line in the plot created in ggplot2

2015-12-24 Thread Giorgio Garziano
Hi Marna, I prepared this toy example that should help you. x <- seq(1:100) y <- x*x avg <- mean(y) avg.v <- rep(avg,100) # your average column data df <- as.data.frame(cbind(x, y, avg.v)) library(ggplot2) ggplot(data=df[,-3], aes(x=x, y=y)) + geom_line() + geom_line(data=df[,c(1,3)], color='b

Re: [R] to change the size of the line in the plot created in ggplot2

2015-12-24 Thread Marna Wagley
Hi Giorgio, Thank you very much for the code and the link. I read it and also used but this code changed the line into "dashed" for all variables. As I mentioned earlier, I wanted to change for only one variable among 7 variables (for only one variable). Thanks MW On Thu, Dec 24, 2015 at 4:10 AM,

Re: [R] to change the size of the line in the plot created in ggplot2

2015-12-24 Thread Giorgio Garziano
You can do it this way, for example: geom_line(linetype="dashed", size=1, colour="blue") Further info at: http://docs.ggplot2.org/current/geom_line.html -- GG [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To