[R] Hershey fonts and substitute()

David Winsemius dwinsemius at comcast.net
Sun Dec 19 22:26:27 CET 2010


On Dec 19, 2010, at 3:25 PM, pilchat wrote:

> Hello R users,
>
> I am new to R, so this may be a very stupid question. I need to  
> subscript the dotted circle (Hershey escape sequence "\\SO") to a  
> string. I tried using
>
>    text(.5,.5,substitute( R[disk] == 5 R["\\SO"] ) )
>
> but it turns out to be a syntax error.
>
> Do you have any suggestion?

The Hershey fonts can be used in the text function:

?Hershey

... but I'm not sure they can be mixed with plotmath expressions. You  
wouldn't be the first person to befrustrated about this:

http://tolstoy.newcastle.edu.au/R/help/02a/1877.html

And note you may need:    par(xpd=TRUE)

Where character ends up will depend on your user coordinate system. I  
had just run the Hershey demo and I needed to push the location down  
to get it on the page:

text(1.5, -2.5, "\\SO", vfont=c("serif","plain") )

You may need to use phantom() in that expression using plotmath,  and  
then "zero in on" the space that is open after the "R" using a second  
call to text.

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

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list