Hello John,
The correct syntax for this in R is:
axis(1, at=1:5, labels=expression(1^10, 2^10, 3^10, 4^10, 5^10))
Note that expression() expects actual R syntax and not strings. To
handle strings you would need to do
axis(1, at=1:5, labels=parse(text=c("1^10", "2^10", "3^10", "4^10",
"5^10")))
The best way to accomplish this task using RPy is to write a little R
wrapper function and call that from RPy:
myAxis = r("function(side, pos, labels) axis(side, at=pos,
labels=parse(text=c(labels)))")
So that you get something like:
from rpy import r
r.plot( [1,2,3,4,5], xaxt="n" )
myAxis = r("function(side, pos, labels) axis(side, at=pos,
labels=parse(text=c(labels)))")
myAxis( side=1, pos=[1,2,3,4,5], labels=["1^10", "2^10",
"3^10",
"4^10", "5^10"] )
-Greg
On May 16, 2007, at 2:17AM , John Owens wrote:
> I'm trying to use "expression" to set axis labels
> (so I can get superscripts, 2^10 for instance).
>
> I think the right nomenclature in R is
>
> expression("2^10", "2^11", ...)
>
> (i.e. r.axis(1, labels=expression(...)))
>
> but I have not been able to get it to work under
> rpy. Any example of how to get the mathplot()-like
> functionality working with expression to typeset
> more complex text would be really appreciated!
>
> Thanks -
>
> JDO
>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> rpy-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rpy-list
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list