Faisal Moledina wrote: > On Mon, Nov 30, 2009 at 4:26 PM, Laurent Gautier <lgaut...@gmail.com> wrote: >>> Next problem: Because I included the option y='..density..' in my >>> histogram aes, my plot now has ..density.. as its x label. This >>> doesn't happen in R. I thought I could rectify this by adding the line >>> pp=pp+ggplot2.opts(xlab="z"), but that doesn't seem to work. If I >>> remove the option y='..density..' from my histogram aes, I get z as my >>> x label, but I still cannot change it using the options (e.g. >>> pp=pp+ggplot2.opts(xlab="z position") has no effect). Any thoughts? >> This is a gpplot2 question, not an rpy2 one, I think (which I can't be all >> answering in good conscience when there is both documentation on the ggplot2 >> website, as well as a recent book available). >> >> From memory, the call should be pp = pp + ggplot2.scale_x_continous("z >> position") >> > > Ack. You're right! I'm too used to qplot() and its options within R, > and don't usually build my plots one layer at a time. Cool, this works > well, then. Thanks again. Last question for this thread: there doesn't > seem to be a ggplot2.theme_set function.
This is an involuntary omission. The rpy2.robjects.lib.ggplot2 module started out as a way to show how to map Python classes onto R classes manually (not matter what flavour of R OOP is used). (I have updated the documentation recently about that http://rpy.sourceforge.net/rpy2/doc-dev/html/robjects.html#working-with-r-s-oops) Since you are already using rpy2-2.1dev (thanks for that, btw), you can work around the missing bits by using importr(). Example: from rpy2.robjects.packages import importr ggplot2_pack = importr("ggplot2") ggplot2_pack.theme_set(ggplot2_pack.theme_bw()) (more about importr() at http://rpy.sourceforge.net/rpy2/doc-dev/html/robjects.html#module-rpy2.robjects.packages) L. > Without having to set every > theme element through opts(), is there a way to set the overall > ggplot2 theme? > >> L. ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list