[R] font size in graphs...can R read Windows settings?

Duncan Mackay dulcalma at bigpond.com
Thu Jul 28 05:43:20 CEST 2016


Hi  Dan

For devices png, pdf, postscript and ? others the pointsize argument
controls the font size which is modified by cex

For lattice there are the settings in trellis.par.get()

trellis.par.get()$fontsize
$text
[1] 12

$points
[1] 8

which you can set and there is no real need to change font size except if
you need to change main.
trellis.par.get()$grid.pars  are the settings for grid elements if used  eg
text

these could be set globally by trellis.par.set() or individually with
argument par.settings eg
xyplot(y ~ x, data = datm,
             par.settings = list(strip.background = list(col =
"transparent"),
                                                 fontsize = list(text = 16,
 
points = 12),  # large size;  need to refine   
                                                superpose.polygon= list(col
= c("red","blue"),
 
border = c("red","blue"))),              
            type = "b")

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Dalthorp,
Daniel
Sent: Thursday, 28 July 2016 07:02
To: r-help at R-project.org (r-help at r-project.org)
Subject: [R] font size in graphs...can R read Windows settings?

Hi All,
I am putting together a package that (among other things) draws some nice
graphs for users. I place some explanatory text on figs using "text" and
"mtext". But the size of the text depends on the Windows display settings:
Smaller (100%), medium (125%) or larger (150%) (In Windows 7... Control
panel | Appearance and personalization | Display | Make text and other
items smaller or larger). If I create figs that look good with one setting,
the text is too big (or too small) if another setting is used in Windows.
If I know the Windows setting, I can use cex in R to make the right sized
labels, but if I don't know a user's Windows display size setting...is
there a way for R to read the setting? Or is there another way to control
label size so that text labels on graphs look good regardless of WIndows
display size setting?

Many thanks for Ideas,

-Dan
-- 
Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 541-750-0953
ddalthorp at usgs.gov

	[[alternative HTML version deleted]]

______________________________________________
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.



More information about the R-help mailing list