Hi Benoit, 

I'm not a specialist of ggplot2, but I will try to help. 
You may obtain more --interesting-- answers on the ggplot2 
mailing list. This said, let's go. 

To solve your problem, I would suggest to 
1. change the form of the data frame (using the reshape library) 
in order to have one variable for Temp, one for the different Xs, 
and one for their y values. 
2. add a new variable for the different molecules.
3. then plot


# change the format of the data frame
library(reshape)
mdat <- melt(THT_N2_ATGMS, id="Temp")

# add the molecule variable 
mdat$mol <- 'other'
mdat$mol[mdat$variable %in% c('X22','X44')] <- 'CO2'
mdat$mol[mdat$variable %in% c('X43','X45')] <- 'AA'

#plot
library(ggplot2)
p <- ggplot(data=mdat, aes(x=Temp, y=value, colour=mol, 
                linetype=variable)) + 
geom_line()
p

that's it. HTH

Matthieu

______________________________________________
R-help@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.

Reply via email to