【问题标题】:RPy2 - ggplot2 - how to modify legend?RPy2 - ggplot2 - 如何修改图例?
【发布时间】:2016-06-23 23:16:33
【问题描述】:

如何修改使用 ggplot2 和 rpy2 构建的绘图的图例? 我的情节如下:

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

我想修改图例的位置。

【问题讨论】:

    标签: python r ggplot2 legend rpy2


    【解决方案1】:

    好的,这样做就足够了:

    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>}))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-06
      • 2012-08-21
      • 1970-01-01
      • 2023-03-12
      • 2013-03-05
      • 2020-05-01
      • 1970-01-01
      • 2014-06-21
      相关资源
      最近更新 更多