Rich Shepard
2015-Jul-02 16:57 UTC
[R] Lattice: set col = "black" for box.rectangle and box.umbrella
On Thu, 2 Jul 2015, David Winsemius wrote:> The lead-in to section 7.2 mentions `trellis.par.get`, but in order to > change anything you need to use `trellis.par.set` as was illustrated in > the pages leading up to that section:David, I saw `trellis.par.set` but did not know how to use that in ~/.Rprofile.> > trellis.par.set(box.umbrella=list(col="black")) > bwplot(decrease ~ treatment, OrchardSprays) > trellis.par.set(box.rectangle=list(col="black")) > bwplot(decrease ~ treatment, OrchardSprays) > > Could do it all at once with: > > trellis.par.set(list( > box.umbrella=list(col="black"), > box.rectangle=list(col="black") > ) > > And Sarkar mentions that this form can be used to create a theme. You may > want to investigate the function `standard.theme` and read section 7.1.4 > of that chapter again.Yes. Modifying the standard.theme would do the job, too. Many thanks, Rich
David Winsemius
2015-Jul-02 17:07 UTC
[R] Lattice: set col = "black" for box.rectangle and box.umbrella
On Jul 2, 2015, at 9:57 AM, Rich Shepard wrote:> On Thu, 2 Jul 2015, David Winsemius wrote: > >> The lead-in to section 7.2 mentions `trellis.par.get`, but in order to >> change anything you need to use `trellis.par.set` as was illustrated in >> the pages leading up to that section: > > David, > > I saw `trellis.par.set` but did not know how to use that in ~/.Rprofile.My .Rprofile has this (among other items): lattice.options(default.args = list(page = function(n) { panel.text(lab = sprintf("%s", date()), x = 0.01, y = 0.01, adj = 0, srt=90) })) It prints a "timestamp" along any Lattice plot I make. I think I picked it several years ago from an R-help posting bt someclever person whose name I am not remembering at the moment. -- David.>> >> trellis.par.set(box.umbrella=list(col="black")) >> bwplot(decrease ~ treatment, OrchardSprays) >> trellis.par.set(box.rectangle=list(col="black")) >> bwplot(decrease ~ treatment, OrchardSprays) >> >> Could do it all at once with: >> >> trellis.par.set(list( >> box.umbrella=list(col="black"), >> box.rectangle=list(col="black") >> ) >> >> And Sarkar mentions that this form can be used to create a theme. You may >> want to investigate the function `standard.theme` and read section 7.1.4 >> of that chapter again. > > Yes. Modifying the standard.theme would do the job, too. > > Many thanks, > > Rich > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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 Alameda, CA, USA
Rich Shepard
2015-Jul-02 17:50 UTC
[R] Lattice: set col = "black" for box.rectangle and box.umbrella
On Thu, 2 Jul 2015, David Winsemius wrote:> My .Rprofile has this (among other items):... David, My attempts at adding lattice.options to .Rprofile fail. In that file is lattice.options(trellis.par.set(list( box.umbrella=list(col="black"), box.rectangle=list(col="black") ) )) and invoking R within emacs displays this warning: Warning message: In trellis.par.set(list(box.umbrella = list(col = "black"), box.rectangle = list(col = "black"))) : Note: The default device has been opened to honour attempt to modify trellis settings [Previously saved workspace restored] Removing the enclosing lattice.options() produces the same error. In section 7.1.4 I'm not groking the correct syntax to change the color of both box items within ~.Rprofile. Rich