[R] graph: axis label font

S Ellison S.Ellison at lgc.co.uk
Tue Jul 14 13:34:02 CEST 2009


R on windows includes some useful functions for windows font handling.
Start with 
?windowsFonts

windowsFonts() 
should show Arial mapped to "sans". (Arial is the default in Windows,
at least in my locale; ?windows tells you that too)

Then try
par(family="sans", font=2) #specifies Arial bold as default

However, this just affects text (as in text() ). You need to be more
specific to specify fonts for particular named plot elements. For
example 
plot(1:10, main="Title in Arial Bold", font.main=2, font.axis=3,
font.lab=4) #specifies bold main title, italic axis tick labels and
italic bold axis labels

compare this with

par(family="serif") #specifies Times 
plot(1:10, main="Title in Times Bold", font.main=2, font.axis=3)
#specifies bold main title and italic axis labels
#note that _all_ the text is in Times.

#If you know your windows font names, you can change the mappings or
add a family:

windowsFonts(comic="TT Comic Sans MS") #sets up your own 'comic'
mapping 
par(family="comic") #specifies that this mapping is the default
plot(1:10, main="Comic", font.main=2, font.axis=3) #specifies bold main
title and italic axis labels - in Comic sans 'cos that's what we set up

Hope that helps,

Steve E

>>> Michael Knudsen <micknudsen at gmail.com> 13/07/2009 18:45:48 >>>
On Mon, Jul 13, 2009 at 5:31 PM, serbring<bracardi82 at email.it> wrote:

> excuse me for my english, i am using R on windows and i have to do
several
> graphs with axis labels and the axis text thicks has a specified font
type,
> (Arial) and a specified font size. How can i do these? Thank you in
advance

Interesting question, I didn't know the answer to, so I tried to look
it up. There might be some help towards the bottom of this page:

http://www.statmethods.net/advgraphs/parameters.html 

It seems to be specific for Windows, so I can't test it myself.

-- 
Michael Knudsen
micknudsen at gmail.com 
http://lifeofknudsen.blogspot.com/ 

______________________________________________
R-help at r-project.org mailing list
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.

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}




More information about the R-help mailing list