|
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) library(lattice) histogram(dt1, xlab = "Histogram of rnorm(0,1)", type = "count", breaks = 15, col = "grey") With regards, J. Powell [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
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 ______________________________________________ [hidden email] 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. |
|
On Wed, Jun 13, 2012 at 8:10 PM, David Winsemius <[hidden email]> wrote:
> > 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]. The actual reason it was not originally implemented is simply that grid did not support it. Of course, the "bad"-ness of hatching may have been the reason grid doesn't support it, and why no one has bothered to change the status quo in so many years. -Deepayan > 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 > > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
|
In reply to this post by David Winsemius
Thank you for your response, I will try to be clearer. I would like to fill my lattice histogram bars using a symbol rather than a color. If that is not possible, then I will use hist() instead.
>From trellis.par.get() bar.fill only includes "col", so perhaps I'm out of luck? With regards, Jeff -----Original Message----- From: David Winsemius [mailto:[hidden email]] Sent: woensdag 13 juni 2012 16:40 To: Powell, Jeff Cc: [hidden email] Subject: Re: [R] histogram fill lattice 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 ______________________________________________ [hidden email] 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. |
|
On Jun 15, 2012, at 5:40 AM, Powell, Jeff wrote: > Thank you for your response, I will try to be clearer. I would like > to fill my lattice histogram bars using a symbol rather than a > color. If that is not possible, then I will use hist() instead. > > From trellis.par.get() > bar.fill only includes "col", so perhaps I'm out of luck? Why didn't you say so ... here ya' go. ?grid.pattern -- David > > With regards, > Jeff > > -----Original Message----- > From: David Winsemius [mailto:[hidden email]] > Sent: woensdag 13 juni 2012 16:40 > To: Powell, Jeff > Cc: [hidden email] > Subject: Re: [R] histogram fill lattice > > > 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 > > > > > David Winsemius, MD West Hartford, CT ______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
