[R] Re : image.plot specify colors for range of data points, please help

Pascal Oettli kridox at ymail.com
Tue Apr 17 17:31:08 CEST 2012


Hi,

> image.plot(x, breaks=c(-100,-1,1,100), col=c('green','black','red'))

Regards,
Pascal


----- Mail original -----
De : David Lyon <david_lyon3 at yahoo.com>
À : "r-help at r-project.org" <r-help at r-project.org>
Cc : 
Envoyé le : Mercredi 18 avril 2012 0h00
Objet : [R] image.plot specify colors for range of data points, please help

Hi

If I had a dataset of the following below and I want to plot colors for this image.plot so that:
red for data above 1
black for data between/equal 1 and -1
green for data below -1

normally its:
image.plot(data) but how do I add the colors for the range of data points as above?


Many thanks for your help!


_DATA_
2.04
2.02
1.60
1.92
0.98
0.50
0.40
-0.50
-0.40
-1.90
-2.8

______________________________________________
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