[R] Changing font in boxplots
John Kane
jrkrideau at yahoo.ca
Wed Aug 8 16:09:12 CEST 2007
--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Wed, 8 Aug 2007, G Iossa, School Biological
> Sciences wrote:
>
> > Hi John,
> >
> > Thanks so much for such a quick reply.
> > I have tried to set all to Times font running
> >
> > par(font.lab=6) (not 4, maybe this is a local
> setting on my machine?)
>
> '6' is a setting specific to certain devices on
> Windows. You should
> really be using font families (which are quite new
> and so not used in
> many of the introductions).
>
> par(family="serif")
>
> will change the default for all the text on
> subsequent plots to be in
> a serif font, which on the windows() device is (by
> default) Times.
>
Thanks, that works beautifully. I had seen the
'family=" once but never needed it and forgot about
it.
> The R posting guide does ask you to tell us your OS,
> so that points like
> this do not have to be guessed at.
>
> > but now the boxplot shown has the x and y labels
> in Times New Roman and the
> > x and y axis still in Arial. Any idea why R is not
> setting those in Times?
>
> Because you did not ask it to. The font of axis
> annotation is set by
> font.axis, not font.lab (which is controls title()'s
> xlab and ylab and
> nothing in axis()). See ?axis and ?par, both of
> which make this clear.
>
> John Kane has claimed that what inline pars are used
> by boxplot() is 'not
> clear from ?boxplot', but the lack of clarity is
> his, not in the
> documentation. ?boxplot refers you to ?bxp, and that
> spells out exactly
> which inline pars are used.
>
> >
> > Thanks a lot for your advice,
> > Graziella
> >
> > --On 08 August 2007 09:16 -0400 John Kane
> <jrkrideau at yahoo.ca> wrote:
> >
> >> I don't know if boxplot will accept a font
> argument.m
> >> From ?boxplot it is not clear.
> >> You may need to set the par() command before the
> >> boxplot
> >>
> >> Example:
> >> par(font.lab=4)
> >> boxplot(mass ~ family, data=mydata, ylab="mass
> %",
> >> xlab="family",las=1, cex.axis=1)
> >>
> >> --- "G Iossa, School Biological Sciences"
> >> <G.Iossa at bristol.ac.uk> wrote:
> >>
> >>> Hi all,
> >>>
> >>> I am very new to R and this might be a simple
> >>> question but I have looked
> >>> everywhere you suggest before writing to you.
> >>>
> >>> I am trying to change font type from san-serif
> to a
> >>> serif (Times New
> >>> Romans) on all labels and axis of my boxplot. I
> have
> >>> used this function in
> >>> other plots before, e.g.:
> >>>
> >>> plot(residuals~lnlifespan, data=mydata,
> pch=psymb,
> >>> font=6, xlab="ln
> >>> reproductive lifespan", ylab="residuals ln
> mass",
> >>> font.lab=6, cex=1.5,
> >>> cex.axis=1.5, cex.lab=1.5)
> >>>
> >>> and found that font.lab or font.axis=6 gives
> Times
> >>> font. However, when I
> >>> try for boxplot:
> >>>
> >>> boxplot(mass ~ family, data=mydata, ylab="mass
> %",
> >>> xlab="family",
> >>> font.axis=6, font=6, par(las=1), cex.axis=1)
> >>>
> >>> it does not work (R does not give any warning
> >>> messages). I have also tried
> >>> family="Times" but without success. Any idea of
> why
> >>> is not doing it and
> >>> what I can do to get Times font on my boxplot?
> >>> I run R on Windows.
> >>>
> >>> Thanks a lot,
> >>> Graziella
> >>>
> >>>
> >>
>
*****************************************************
> >>> Dr. Graziella Iossa
> >>>
> >>> Mammal Research Unit
> >>> School Biological Sciences
> >>> University of Bristol
> >>> Woodland Road
> >>> Bristol BS8 1UG, UK
> >>>
> >>> E-mail: G.Iossa at bristol.ac.uk
> >>> Tel 0044 (0)117 9288918
> >>> Fax 0044 (0)117 3317985
> >>>
> http://www.bio.bris.ac.uk/research/mammal/index.html
> >>> http://www.bio.bris.ac.uk/people/Iossa.htm
>
> --
> 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