[R] Trellis devices and pointize

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jun 9 09:33:35 CEST 2014


The issue here is not trellis.device.

You are using lattice plots (without mentioning lattice), which are 
based on package 'grid' and so using the grid sub-system of a device. 
That sub-system does not use the 'pointsize' of the device as its 
initial font size.  So you need to use

grid::gpar(fontsize = 28)

If I call that after opening the device I get what I guess you expected.


On 09/06/2014 07:54, Patrick Connolly wrote:
> How is the pointsize set in trellis.devices?
>
>>From my reading of the trellis.device help file, I understood that the
> pointsize arg would be referenced to the call to the pdf function.
>
> So I set up a trellis pdf device as so:
>
>    trellis.device(device = pdf, file = "Singers.pdf", height = 160/25.4,
>                   width = 160/25.4, pointsize = 28)
>
> A base R graphics plot works as I'd expected.
>
>    plot(1:10, 50:59) # silly plot with huge plotting characters and letters
>
> However, pointsize is ignored in trellis plots;
>
>    pik <- bwplot(voice.part ~ height, data = singer)# pointsize ignored
>    print(pik)
>    dev.off()
>
> There are many trellis cex-type settings, but FWIU they're all
> relative to the default size.  My question is: How do I set that
> default?
>
>
> R version 3.0.2 (2013-09-25)
> Platform: i686-pc-linux-gnu (32-bit)
>
> locale:
>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] grDevices utils     stats     graphics  methods   base
>
> other attached packages:
> [1] RColorBrewer_1.0-5 lattice_0.20-24
>
> loaded via a namespace (and not attached):
> [1] grid_3.0.2  plyr_1.8    tools_3.0.2
>
> I've tried with R-3.1.0 on another machine so I don't think the
> problem is with an old version.
>
> I doubt it has much to do with pdf specifically.  Attempts to use png,
> bitmap, postscript devices all produce equivalent results.
>
>
>
> (Here's all the example code uninterrupted:)
>
>    trellis.device(device = pdf, file = "Singers.pdf", height = 160/25.4,
>                   width = 160/25.4, pointsize = 28)
>    plot(1:10, 50:59) # silly plot with huge plotting characters and letters
>    pik <- bwplot(voice.part ~ height, data = singer)# pointsize ignored
>    print(pik)
>    dev.off()
>
>
> TIA
>
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list