[R] profile plot in R
Vickie S
isvik at live.com
Mon Jun 20 14:20:53 CEST 2011
Hi thanks for the help.
Here is the error message i got. I could not figure out what goes wrong here.
======
require(ggplots2)
sampledata=data.frame(c(1.002, 1.76, 0.67, 0.99), c(1.38,1.0,0.5, 0.78), c(1.003,0.57,0.99, 0.58),c(0.76,1.23, 1.45, .78), c(1.43, 1.34, 1.0, 0.9))
rownames(sampledata)=c("cond1", "cond2", "cond3", "cond4")
colnames(sampledata)=c("col1", "col2", "col3", "col4", "col5")
grp=c("grp1", "grp1", "grp2", "grp3")
sampledata=cbind(sampledata, grp)
long.dat=melt(sampledata[,1:5], idvars=as.character(rownames(sampledata)), measure.vars=as.character(colnames(sampledata)[1:5]), variable_name="cols")
ggplot(long.dat, aes(x = cols, y = value)) +
+ geom_line(aes(colour = sampledata$grp)) +
+ facet_grid(~ rownames(sampledata))
Error in get("make_aesthetics", env = x, inherits = TRUE)(x, ...) :
could not find function "empty"
=====
thanks again,
Vickie S
----------------------------------------
> CC: r-help at r-project.org
> From: jwiley.psych at gmail.com
> Subject: Re: [R] profile plot in R
> Date: Sat, 18 Jun 2011 08:24:01 -0700
> To: isvik at live.com
>
> Hi,
>
> Another easy option would be to convert your data to "long" format and then use ggplot2 or lattice. Something like (though not exact without a reproducible example):
>
> require(ggplot2)
> long.dat <- melt(your_data, arguments)
>
> ggplot(long.dat, aes(x = variable, y = value)) +
> geom_line(aes(colour = group)) +
> facet_grid(~ condition)
>
> HTH,
>
> Josh
>
> On Jun 17, 2011, at 12:43, Vickie S <isvik at live.com> wrote:
>
> >
> > Hi friends,
> >
> > I have a matrix with following format.
> >
> > group var1 var2 .......varN
> >
> > c1 group1 1.2399 1.4990....-1.4829
> >
> > c2 group4 0.8989 0.7849.....1.8933
> >
> > ...
> >
> > ...
> >
> > c100 group10 .....
> >
> >
> >
> > I want to draw a profile plot
> > of each condition c1 to c100, which rows in above matrix and each line
> > representing a row should be uniquely colored according to the group(1
> > to 10).
> >
> > I think this is simple task but I could not figure out how to set the colors.
> >
> >
> >
> > Any help would be appreciated.
> >
> >
> >
> > thanks
> >
> > -Vickie
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list