[R] in other words Re: How to use fixed-width fonts such as courier in R

Paul Murrell p.murrell at auckland.ac.nz
Tue May 24 23:29:20 CEST 2005


Hi

Does this do what you want?

postscript("example.ps", fonts=c("sans", "mono"))
plot(1:10, axes=FALSE, ann=FALSE)
par(family="sans") # By default Helvetica which is like Arial
title(xlab="sans serif axis label")
title(ylab="bold sans serif axis label", font.lab=2)
par(family="mono") # By default Courier
axis(1,
      at=seq(2, 8, 2),
      label=c("mono", "space", "tick", "labels"))
axis(2,
      at=seq(2, 10, 2),
      label=c("bold", "mono", "space", "tick", "labels"),
      font.axis=2)
box()
dev.off()

You might also want to take a look at the article "Fonts, lines, and 
transparency ..." in R News 4/2 
http://cran.stat.auckland.ac.nz/doc/Rnews/Rnews_2004-2.pdf

Paul


Xiang Li wrote:
> the problem is how to use both courier bold font for axis and arial
> bold font for labelling.  If I use familiy = "courier" in postscript,
> everything will become courier fonts ......
> 
> I noticed that in postscirpt help page, we can customize a family such as
> "family = c("CM_regular_10.afm","CM_boldx_10.afm", "cmti10.afm",
> "cmbxti10.afm", "CM_symbol_10.afm";
> 
> However, I tried many times, and just don't know the symbol used in R for
> courier bold or arial bold, etc.
> 
> 
> 
> 
>>Hi,
>>  I am trying to use Arial bold for labelling (font.lab =2), and use
>>the fixed-width Courier bold for axis. I will export the plot to .ps
>>format. I have been trying to use font.axis = 11, but that doesn't work
>>when I exported the plot to a .ps file.
>>
>>  I have been trying hard to read the help page of "postscript" these few
>>days, but didn't get the courier font yet.  Can you please help me
>>figure out how I should use "postscript"? Thanks!
>>
>>Best
>>
>>Sean
>>
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list