[R] Set Colour of Histogram Bars (lattice)

Dieter Menne dieter.menne at menne-biomed.de
Fri Feb 19 16:12:51 CET 2010



DarioAustralia wrote:
> 
> 
> I have a bunch of histogram bars that I'd like the first to be a certain
> colour, second to be another colour, third to be a third colour, and
> repeat for all my 39 bars.
> 
>> levels(forPlot$type)
> [1] "Blah" "Blah 2" "Blah 3" 
> 
> trellis.par.set("plot.polygon$col", c("red", "green", "blue"))
> histogram( ~ cpgBin:type, data = forPlot, scales = list(x = list(rot =
> 90)), main = "CpG Density vs. 

Please provide a self-contained example, not some mysterious data on your
disk.

Dieter


library(lattice) 
df = data.frame(type=sample(letters[1:9],1000,TRUE))
histogram(~type,data=df,col=c("red","green","blue"))




-- 
View this message in context: http://n4.nabble.com/Set-Colour-of-Histogram-Bars-lattice-tp1561123p1561766.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list