[R] Math expressions in pie chart labels?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed May 3 18:17:17 CEST 2006


Maybe because ?pie says

   labels: a vector of character strings giving names for the slices.
           For empty or NA labels, no pointing line is drawn either.

Note, nothing about expressions ....

pie() contains

         if (!is.na(lab <- labels[i]) && lab != "") {

and so it would be easy to extend to something like

         if (!is.expression(lab <- labels[i]) ||
             (!is.na(lab) && lab != "")) {



On Wed, 3 May 2006, Uwe Ligges wrote:

> Johannes Graumann wrote:
>
>> On Tuesday 02 May 2006 23:33, Uwe Ligges wrote:
>>
>>> Then please read ?plotmath and use it:
>>>
>>> labels = expression("" >= 0.66, "" == 0.33, "" <= -0.33, "" <= -0.66)
>>
>>
>> Error in lab != "" : comparison is not allowed for expressions
>> In addition: Warning message:
>> is.na() applied to non-(list or vector) in: is.na(lab <- labels[i])
>>
>> I don't seem to be the only one having problems with this ;0)
>
>
> Then please tell us the details, I just tried successfully:
>
> plot(1:10, xaxt="n")
> axis(1, at = c(1,3,5,7), labels =
>      expression("" >= 0.66, "" == 0.33, "" <= -0.33, "" <= -0.66))
>
> Uwe Ligges
>
>> Joh
>
> ______________________________________________
> 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
>

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