Re: [R] Plot colors

From: Julian Burgos <>
Date: Fri, 30 May 2008 11:17:09 -0700

You could do something like this:

color= as.numeric(mydata== -1) +1

This will give you a plot where the -1's are in red (color = 2) and the other numbers in black (color=1).


uv wrote:
> Hi. I am plotting graphs for values ranging between -1 and 10, for example:
> (1,2,1,1,6,7,-1,-1,5,-1)
> I am trying to plot the graphs so that the points with value of -1 will be
> in one specific color, and the rest of the points will be in one different
> specific color. I would be grateful for any idea of how to do that in two
> colors.
> Thanks for any hint.

Julian M. Burgos

Fisheries Acoustics Research Lab
School of Aquatic and Fishery Science
University of Washington

1122 NE Boat Street
Seattle, WA  98105 

Phone: 206-221-6864

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 02 Jun 2008 - 04:40:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jun 2008 - 05:30:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive