我正在尝试使用 rpy2 在 ggplot2 中自定义图例。我注意到 ggplot2 到 rpy2 没有 scale_shape_discrete
以及 http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/ 中显示的其他方法根据需要定制图例。
from rpy2.robjects.lib import ggplot2
# not present
ggplot2.scale_shape_discrete
通过 rpy2 重命名/自定义 ggplot2 中离散图例的正确方法是什么?这些方法可以访问吗?
最佳答案
它不见了。你可以
1) 在 rpy2 的 bitbucket 页面上报告问题。
2)将其定义为:
from rpy2.robjects.lib import ggplot2
class ScaleShapeDiscrete(ggplot2.Scale):
_constructor = ggplot2.ggplot2_env['scale_shape_discrete']
scale_shape_discrete = ScaleShapeDiscrete.new
关于python - 使用 rpy2 更改 ggplot2 中的图例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15480031/