[R] Superscript followed by number then superscript in text

Benjamin Gillespie gybrg at leeds.ac.uk
Tue Mar 19 10:23:06 CET 2013


Thanks to Dennis, Thomas and Rui - I was missing the "~".

Many thanks,

Ben Gillespie
Research Postgraduate

________________________________________
From: Dennis Murphy [djmuser at gmail.com]
Sent: 18 March 2013 20:47
To: Benjamin Gillespie
Subject: Re: [R] Superscript followed by number then superscript in text

Hi:

plot(1, 1)
text(1, 0.8, expression("capacity"~10^3~"m"^3))

Dennis

On Mon, Mar 18, 2013 at 1:29 PM, Benjamin Gillespie <gybrg at leeds.ac.uk> wrote:
> Hi all,
>
> I'm having problems finding the correct format for a command.
>
> I would like to write some text on a plot.
>
> I'm using the following command:
>
> text(x,y,"text here", srt=90)
>
> I would like the text to read:
>
> capacity 10^3 m^3
>
> (with ^ denoting superscript (i.e. each '3' as superscript).
>
> I've tried fiddling around with expression(paste(etc.... to no avail. I receive errors such as: "Error: unexpected numeric constant..."
>
> Anyone had experience with this before? Any suggestions would be great.
>
> Many thanks in advance,
>
> Ben Gillespie
> Research Postgraduate
>
> School of Geography
> University of Leeds
> Leeds
> LS2 9JT
> ______________________________________________
> 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.



More information about the R-help mailing list