On Dec 5, 2011, at 10:44 AM, Federico Calboli wrote:
Hi All,

I'm having a problem with barplot:

mydata
[1,] 2 108 0 0 0 1 3 0 0 0 0 0 7 18 3 4 8 20 26 20 19 7 1 1
mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2),  
rep('white', 5), rep('orange',3), rep('red',9))
barplot(mydata, col = mycol)

gives me an uniformly yellow barplot. How do I solve this?
Hard to say, since it involves graphics devices and I cannot reproduce  
it.
> mydata <- scan()
1: 2 108 0 0 0 1 3 0 0 0 0 0 7 18 3 4 8 20 26 20 19 7 1 1
25:
Read 24 items
> barplot(mydata)
> ?barplot
> mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2), rep('white', 5), rep('orange',3), rep('red',9))
>
> barplot(mydata, col = mycol)

Gives a multicolored display on my machine:

Attachment: Rplot.pdf
Description: Adobe PDF document

bw

Federico



--
Federico C. F. Calboli
Neuroepidemiology and Ageing Research
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.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.
David Winsemius, MD
West Hartford, CT

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

Reply via email to