se7entyse7en
se7entyse7en

Reputation: 4294

RPy2 - ggplot2 - how to modify legend?

How can I modify the legend of a plot built using ggplot2 with rpy2? My plot is the following:

plot_2 = (ggplot2.ggplot(second_dt) +
          ggplot2.aes_string(x='timestamp', y='diff_percentage') +
          ggplot2.geom_point() +
          ggplot2.geom_line())

and I would like to modify the position of the legend.

Upvotes: 0

Views: 140

Answers (1)

se7entyse7en
se7entyse7en

Reputation: 4294

Ok it was sufficient to do as follows:

plot_2 = (ggplot2.ggplot(second_dt) +
          ggplot2.aes_string(x='timestamp', y='diff_percentage') +
          ggplot2.geom_point() +
          ggplot2.geom_line() +
          ggplot2.theme(**{'legend.position': <position>}))

Upvotes: 0

Related Questions