[R] histogram fill lattice

David Winsemius dwinsemius at comcast.net
Wed Jun 13 16:40:27 CEST 2012


On Jun 13, 2012, at 9:55 AM, Powell, Jeff wrote:

>
> Dear all,
>
> I would like to change the "fill" pattern of a histogram using  
> histogram() in the lattice package.  I know how to do so using  
> hist(), but would prefer to stay within lattice.
>
> dt1 <- rnorm(100,0,1)
>
> hist(dt1, density=3, angle=45)
>

I get diagonal striping.

>
> library(lattice)
> histogram(dt1,
>               xlab = "Histogram of rnorm(0,1)",
>               type = "count",
>               breaks = 15,
>               col = "grey")

I seem to remember that the diagonal hatched fills were disabled or  
not brought over to lattice from base S graphics because they were  
thought to be causing cognitive distortions[1,2]. You already seem to  
be able to specify the color of the fill, and it's easy to get  
alternating colored fills with col = c("grey","red") ,  so it's not  
entirely clear what your unsatisfied goals are.

-- 
David Winsemius, MD
West Hartford, CT

1] http://markmail.org/message/pmrrpjynrcnrwhg5?q=list:org%2Er-project%2Er-help+lattice+hatching
2] http://markmail.org/message/cj23tnsgsobs4mbu?q=list:org%2Er-project%2Er-help+lattice+hatching



More information about the R-help mailing list