[R] R-1.8.1-4: Font family, ticks and mathematical expression??

Paul Murrell p.murrell at auckland.ac.nz
Wed Mar 17 21:51:32 CET 2004


Hi


Prof Brian Ripley wrote:
> On Wed, 17 Mar 2004, Pisut Tempatarachoke wrote:
> 
> 
>>Hi all,
>>
>>Could anyone help answer the following questions, please?
>>(I'm using R-1.8.1-4 on Fedora Core 1 and very new to R)
>>
>>(i) Is it possible to specify a font family (e.g. courier or helvetica) 
>>when graphing?
> 
> 
> `when graphing' means what?  Some graphics devices, e.g. postscript and
> pdf support families.  X11() does not in 1.8.1 but will in 1.9.0, due
> early April.
> 
> 
>>(ii) How can I make ticks point inwards on all four sides of a plot?  Is 
>>it possible to have minor and major ticks?
> 
> 
> Their height (including direction) is controlled by par's tcl and tck --
> this is in `An Introduction to R'. See ?par.
> 
> You cna get major and minor ticks by calling axis twice with different par 
> values, if I understand you aright.
> 
> 
>>(iii) How would I specify a symbol "\sim" (i.e. "~") in a mathematical 
>>expression?  So far, I've only seen "%~~%", but that's not exactly what 
>>I'm after.  (I tried "%~%" but that didn't work.)
> 
> 
> Try demo(plotmath) for what is supported.  \sim is just a character in the 
> symbol font, but I don't know how to access those directly.


Does this do what you want ...?

plot(1:10)
text(4, 2, expression(x*tilde("   ")*y))

Depending on the complexity of your expression, Hershey fonts may be an 
alternative ...

plot(1:10)
text(4, 2, "x \\ap y", vfont=c("sans serif", "italic"))

Paul
-- 
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