Guessing that math_format()
is in scales
(can't check it right now), and based on Brian's answer the rpy2 version should be the following:
from rpy2.robjects.lib import ggplot2
from rpy2.robjects.packages import importr
scales = importr("scales")
p = ggplot2.ggplot(mtcars) + \
ggplot2.aes_string(x="wt", y="mpg")) + \
ggplot2.geom_point() + \
ggplot2.scale_x_continuous(labels = scales.math_format("2^.x"))
p.plot()