Sub/Superscript in plot in a loop

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Sub/Superscript in plot in a loop

mavkoup
I have a for loop with counter i and I'm producing plots where I ultimately want to label the axes:

"Entry a_i from P^q", where a, P and q are just letters, and i is the value of the for loop counter.

I've tried various combinations of paste, expression and substitute, but I can't get this to work nicely.

Thanks much!

Reply | Threaded
Open this post in threaded view
|

Re: Sub/Superscript in plot in a loop

David Winsemius

On Apr 7, 2011, at 9:46 PM, mavkoup wrote:

> I have a for loop with counter i and I'm producing plots where I  
> ultimately
> want to label the axes:
>
> "Entry a_i from P^q", where a, P and q are just letters, and i is  
> the value
> of the for loop counter.
>
> I've tried various combinations of paste, expression and substitute,  
> but I
> can't get this to work nicely.

I'll bet you haven't tried:

as.expression(bquote(Entry~.(a)[.(i)]~from~.(P)^.(q)))


--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.