[R] Plot colour according to column
Tsjerk Wassenaar
tsjerkw at gmail.com
Wed Feb 9 20:20:37 CET 2011
Hi Anoop,
Not sure whether it's too late for you, but is this along the lines of
what you want?:
x<-0:1000
y<-sin(x/500)+rnorm(1001)/10
z<-cos(x/500)+rnorm(1001)/100
plot(x,y,col=rgb(1,(z-min(z))/(max(z)-min(z)),0))
Or possibly like:
plot(x,y,col=rainbow(256)[255*(z-min(z))/(max(z)-min(z))])
Mind that the binning could be done a bit more conscientious ;)
Hope it helps,
Tsjerk
On Wed, Feb 9, 2011 at 6:30 PM, anoopmj <anoopmj at gmail.com> wrote:
>
> Hi Jim,
>
> Thanks a lot for the response. I finally decided to do it with ggplot2
> library, qplot and layers. It works pretty well, although I did not know how
> to get the time working... so thanks!
>
> Anoop
> --
> View this message in context: http://r.789695.n4.nabble.com/Plot-colour-according-to-column-tp3275655p3297750.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
--
Tsjerk A. Wassenaar, Ph.D.
post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands
--
Tsjerk A. Wassenaar, Ph.D.
post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands
More information about the R-help
mailing list