문제

I am trying to customize a legend in ggplot2 using rpy2. I notice that ggplot2 through rpy2 does not have scale_shape_discrete and other methods that are shown in http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/ as necessary for customizing legends.

from rpy2.robjects.lib import ggplot2
# not present
ggplot2.scale_shape_discrete 

What's the correct way to rename/customize discrete legends in ggplot2 through rpy2? Are these methods accessible?

도움이 되었습니까?

해결책

It is missing. You can

1) report the issue on the bitbucket page for rpy2.

2) define it as:

from rpy2.robjects.lib import ggplot2
class ScaleShapeDiscrete(ggplot2.Scale):
    _constructor = ggplot2.ggplot2_env['scale_shape_discrete']
scale_shape_discrete = ScaleShapeDiscrete.new
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top