[R] profile plot in R
Vickie S
isvik at live.com
Tue Jun 21 00:07:10 CEST 2011
Hi Dennis and all friends,
After upgrading to R 2.11.1, I managed to work this out perfectly. I also added group information here, since I wanted to color code the profiles according to the groups they were assigned to.
library("reshape")
library("ggplot2")
sampledata <- matrix(c(1.002, 1.76, 0.67, 0.99, 1.38, 1.0, 0.5, 0.78, 1.003,0.57, 0.99, 0.58, 0.76, 1.23, 1.45, .78,1.43, 1.34, 1.0, 0.9),ncol = 5, dimnames = list(cond=c("cond1", "cond2","cond3", "cond4"),time = c("col1","col2", "col3", "col4", "col5")))
sdata <- melt(sampledata) # melt method for matrices
grp=c("grp1", "grp1", "grp2", "grp2")
ggplot(sdata, aes(time, value, colour=grp)) +
geom_point(size = 2.5) +
geom_line(aes(group = cond), size = 1)
Once again many thanks for the help,
- Vickie
More information about the R-help
mailing list