On 04/09/10 12:45, Moritz Beber wrote:
Hi everyone,

I have a problem with achieving the following: I have a plot that I'm very happy with and I'd like to add some label text at certain positions. I use rpy2 and ggplot2. My problem is basically that for the geom_text I would like to specifiy a different aes_string so that I can change the y positions.

Hi,

If the new //y/ an be derived for the information in your DataFrame /data/:
...+
ggplot2.geom_text(ggplot2.aes_string(y = "dynamic + 3"), colour="black") +
...
If not:
...+
ggplot2.geom_text(ggplot2.aes_string(y = "foo"), colour="black", data = anotherdataframe) +
...

If that's not possible can I somehow push a complete layer to the grDevice and then add a second layer on top?

There were recent additions to the documentation, some of them show how to add grid viewports.

Check the last example at:
(rpy2-2.1)
http://rpy.sourceforge.net/rpy2/doc-2.1/html/graphics.html#package-grid
(rpy2-2.2)
http://rpy.sourceforge.net/rpy2/doc-2.2/html/graphics.html#package-grid



Laurent



For reference, here's the code that I use:

dataf = r_objects.DataFrame(data)
# plot
gp = ggplot2.ggplot(dataf)
plot_title = "Uniform Random Dynamic Value"
pp = gp +\
ggplot2.aes_string(x="xpos", y="dynamic", ymin="min", ymax="max", colour="factor(scheme)", label="label") +\
ggplot2.geom_errorbar(position="dodge") +\
ggplot2.geom_line() +\
ggplot2.facet_grid(r_objects.Formula("mpos ~ .")) +\
ggplot2.scale_x_continuous("Motif") +\
ggplot2.scale_y_continuous("Dynamic Value") +\
ggplot2.geom_text(colour="black") +\
ggplot2.opts(title=plot_title)
pp.plot()

TIA,
Moritz


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd


_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to