[R] asterisk in subscript

Andrew Collier collierab at gmail.com
Fri Jan 28 11:24:23 CET 2011


thanks for the rapid response.

yes, in x11 your suggestion works perfectly. i have never thought of the
asterisk as being a superscript... to me it has always been the
"mulitply" sign which is centred. thanks for the education!

however, my plot is being sent to postscript, which i guess does not
support unicode because i get a whole flurry of warnings and the text on
the plot is not correct.

Warning messages:
1: In title(...) : font metrics unknown for Unicode character U+2217
2: In title(...) : font metrics unknown for Unicode character U+2217
3: In title(...) : font metrics unknown for Unicode character U+2217
4: In title(...) : font metrics unknown for Unicode character U+2217
5: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for <e2>
6: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for <88>
7: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for <97>
8: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for <e2>
9: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for <88>
10: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for <97>

the plotting command is

plot(NA, xlim = c(0,10), ylim = c(0, 20), ylab =
expression(paste(symbol("\341"), italic(n), symbol("\361"))), xlab =
expression(paste(italic(n)["\u2217"])))

i am just using the "plain vanilla" font (no changes).

it is being run on R version 2.11.1 (2010-05-31) under ubuntu.

my locale is

LC_CTYPE=en_ZA.utf8;LC_NUMERIC=C;LC_TIME=en_ZA.utf8;LC_COLLATE=en_ZA.utf8;LC_MONETARY=C;LC_MESSAGES=en_ZA.utf8;LC_PAPER=en_ZA.utf8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.utf8;LC_IDENTIFICATION=C


-- 
Andrew B. Collier

Physicist
Waves and Space Plasmas Group
Hermanus Magnetic Observatory

Honorary Senior Lecturer                             tel: +27 31 2601157
Space Physics Research Institute                     fax: +27 31 2607795
University of KwaZulu-Natal, Durban, South Africa    gsm: +27 83 3813655



On Fri, 2011-01-28 at 09:48 +0000, Prof Brian Ripley wrote: 
> On Fri, 28 Jan 2011, Andrew Collier wrote:
> 
> > hi,
> >
> > i am trying to label a plot axis with the equivalent of the latex $n_*$.
> > i initially tried
> >
> > expression(paste(italic(n)["*"]))
> >
> > but this made the * absolutely tiny and centred about midway wrt the n.
> > then
> >
> > expression(paste(italic(n)[textstyle("*")]))
> >
> > made the * about the right size but now it looks more like a superscript
> > than a subscript.
> >
> > does anyone have an idea of how to get the * to the "right" subscript
> > position (ie. somewhere near the baseline of the n)? thanks!
> 
> I think these *are* correct: remember that an asterisk is a 
> superscript.  However, what you see depends on the graphics device and 
> font you used, and you have not told us (pace the posting guide).  If 
> your OS and device support Unicode, try \u2217:
> 
> expression(paste(italic(n)["\u2217"]))
> 
> looks about right to me (X11() on Linux).
> 
> > best regards,
> > andrew.
> >
> > -- 
> > Andrew B. Collier
> >
> > Physicist
> > Waves and Space Plasmas Group
> > Hermanus Magnetic Observatory
> >
> > Honorary Senior Lecturer                             tel: +27 31 2601157
> > Space Physics Research Institute                     fax: +27 31 2607795
> > University of KwaZulu-Natal, Durban, South Africa    gsm: +27 83 3813655
>



More information about the R-help mailing list