[R] Patterns in histogram

David Winsemius dwinsemius at comcast.net
Thu Jan 7 17:45:00 CET 2010


On Jan 7, 2010, at 10:42 AM, dbeest wrote:

>
> I’ve been busy making some histograms and I would like to distinguish
> different groups. I’ve been doing it like this:
>
> a <- c(1,1,1,1,2,2,2)
> hist(a,breaks=c(0,1,2))
> hist(a[3:5],breaks=c(0,1,2),col="red",add=TRUE)
>
> Basically plotting them over each other, I assume there is a better
> way…Anyway what I want to do is make them in grayscale which  
> essentially
> means giving different groups patterns. I’ve been playing around with
> “density” and “angle”
>
> a <- c(1,1,1,1,2,2,2)
> hist(a,breaks=c(0,1,2))
> hist(a[3:5],breaks=c(0,1,2),add=TRUE,,density=3,angle=9)
>
> Although you can make many different combinations with these I  
> wondered if
> there are “patterns” (dots for example) available in the similar  
> fashion as
> the colors (col="red" or pattern="dots")

I have not been able t find such. But you can also get the shading  
lines to respond to lty and to a very limited extent to lwd, ...  at  
least I was not able to get arbitrarily thick lines on my screen  
graphics device (Quartz). The help pages I looked at suggested that  
different graphics devices might have varying parameters that could be  
fiddled with.

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list