[R] color scale to label a plot

Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com
Thu Jul 15 19:02:52 CEST 2004


Anne:

Perhaps this example will help.  

I have data (several dozen observations at each condition) for different
R=stress.ratio.  The stress.ratios are:

> stress.ratio
 [1] 0.1 0.1 0.1 0.2 0.3 0.5 0.6 0.7 0.8 0.9 0.9 0.9 0.9 0.9 0.9

You will notice multiple datasets for R=0.1 and R=0.9.

I assigned colors to each stress.ratio, such that

 R.color
 [1] "black"      "black"      "black"      "red"        "orange"     "gray"
"green"      "light blue" "blue"       "dark blue" 
[11] "dark blue"  "dark blue"  "dark blue"  "dark blue"  "dark blue" 


Then I plotted the legend on my plot this way:

legend(x.coordinate, y.coordinate, unique(stress.ratio),
col=unique(R.color), pch=15, cex=0.8)

Best wishes.

Charles Annis, P.E.
 
Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  503-217-5849
http://www.StatisticalEngineering.com
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Anne
Sent: Thursday, July 15, 2004 12:42 PM
To: r-help at stat.math.ethz.ch; Berton Gunter
Subject: Re: [R] color scale to label a plot

yes..  legend sould help. I still do not know how to paint my color sacle
and put the corresp. labels correctly
Thanks
Anne

----- Original Message ----- 
From: "Berton Gunter" <gunter.berton at gene.com>
To: "Anne" <anne.piotet at urbanet.ch>
Sent: Thursday, July 15, 2004 5:55 PM
Subject: Re: [R] color scale to label a plot


> Do you mean ?legend  ??
>
> On lattice plots, the key= argument controls legends. ?xyplot gives
details.
>
>
>
> --
>
> Bert Gunter
>
> Non-Clinical Biostatistics
> Genentech
> MS: 240B
> Phone: 650-467-7374
>
>
> "The business of the statistician is to catalyze the scientific learning
process."
>
>  -- George E.P. Box
>
>

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list