Re: [R] Plot colors

2008-05-30 Thread Julian Burgos

You could do something like this:

mydata=c(1,2,1,1,6,7,-1,-1,5,-1)
color= as.numeric(mydata== -1) +1
plot(mydata,col=color)

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


Julian


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

__
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.


[R] Plot colors

2008-05-29 Thread uv

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.
-- 
View this message in context: 
http://www.nabble.com/Plot-colors-tp17539738p17539738.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Plot colors

2008-05-29 Thread Henrique Dallazuanna
Try:

x - c(1,2,1,1,6,7,-1,-1,5,-1)
plot(x, col = ifelse(x == -1, red, black), pch = 16)


On Thu, May 29, 2008 at 1:23 PM, uv [EMAIL PROTECTED] 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.
 --
 View this message in context:
 http://www.nabble.com/Plot-colors-tp17539738p17539738.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

__
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.