Python 如何从ggplot2访问rpy2中的theme_classic?
如何从Python中的rpy2访问Python 如何从ggplot2访问rpy2中的theme_classic?,python,ggplot2,rpy2,Python,Ggplot2,Rpy2,如何从Python中的rpy2访问theme\u classic?即: 有没有办法从rpy2使用它?有。如果在rpy2.robjects.lib.ggplot2中使用手动映射,当前是否缺少该映射,但修补该映射的方法应为: import rpy2.robjects.lib.ggplot2 as ggplot2 class ThemeClassic(ggplot2.Theme): _constructor = ggplot2.ggplot2.theme_classic @clas
theme\u classic
?即:
有没有办法从rpy2使用它?有。如果在
rpy2.robjects.lib.ggplot2
中使用手动映射,当前是否缺少该映射,但修补该映射的方法应为:
import rpy2.robjects.lib.ggplot2 as ggplot2
class ThemeClassic(ggplot2.Theme):
_constructor = ggplot2.ggplot2.theme_classic
@classmethod
def new(cls):
res = cls(cls._constructor())
return res
# Monkey patching ggplot2
ggplot2.theme_classic = ThemeClassic.new
非常好,谢谢!你对这件事有什么想法吗?悬而未决的问题