[R] Lattice: set col = "black" for box.rectangle and box.umbrella

David Winsemius dwinsemius at comcast.net
Thu Jul 2 18:25:41 CEST 2015


On Jul 2, 2015, at 7:46 AM, Rich Shepard wrote:

>  Lattice's bwplot() displays and prints (using pdf()) the box.rectangle and
> box.umbrella in a pale blue that is a pale gray on b&w laser printer output.
> I would like to set default options so the box and whiskers are displayed
> and printed in black by modifying ~/.Rprofile by adding a .First() function.
> 
>  Reading Chapter 7 in Deepayan's book and the ?Startup man page did not
> result in my understanding the correct syntax for
> lattice.options(default.args = list(...)) in ~/.Rprofile. Web searches did
> not find guidance, either.
> 
>  Would appreciate help on learning how to set these options so they are
> effective when R is invoked.

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:


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.

-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list