[R] Male and female signs as subscript in plot

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jul 1 09:40:07 CEST 2013

On 01/07/2013 03:19, Emily Weiser wrote:
> Hello,
> I'd like to add labels to my plot that include a male or female symbol as
> subscript.
> I'm working in Windows Vista and R 3.0.0.
> I am able to add the male symbol to the plot as regular text (NOT as
> subscript), e.g. with:
> mtext("Male\u2642")
> This displays the word "Male" followed by the male symbol on the plot.
> But "\u2642" does not work when I try to put it as a subscript.
> For example,
> mtext(expression("Male"["\u2217"]))
> successfully adds an asterisk as a subscript after the word "Male".
> However,
> mtext(expression("Male"["\u2642"]))
> displays the word "Male" followed by a subscript of "<U+2642>", i.e. the
> symbol is not displayed.
> How can I make the male symbol show as a subscript?

You cannot use non-native text with plotmath.  The issue is not that you 
used a subscript but that you passed an expression() call and hence 
invoked plotmath.  And the help does say

      In non-UTF-8 locales there is normally no support for symbols not
      in the languages for which the current encoding was intended.

> Many thanks for any suggestions!

Read all of ?plotmath.

> Cheers,
> Emily
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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.

No HTML postings please.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list