Skip to content
Back to formatted view

Raw Message

Message-ID: <BAY156-w33E43C8742EEBADBFB95EFCD6E0@phx.gbl>
Date: 2011-06-20T22:07:10Z
From: Vickie S
Subject: profile plot in R
In-Reply-To: <BANLkTi=5+h_kVReX0c1z8_Qr+qczxKmyJQ@mail.gmail.com>

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