python - is ggplot2.layer fully supported in Rpy2? -
i trying utilize ggplot2 layer
in graph plotted via rpy2, don' see described in manual (http://rpy.sourceforge.net/rpy2/doc-2.1/html/graphics.html)
is right form calling layer
function following? r,
p <- p + layer(data=df, mapping=aes(x=x, y=y, label=foo), geom='text', hjust=1, vjust=1)
should in rpy2:
p += ggplot2.layer(**{"data": df, "mapping": ggplot2.aes_string(x="x", y="y", label="foo"), "geom": "text"}) "hjust": 1, "vjust": 1})
when seek this, errors like:
typeerror: new() got unexpected keyword argument 'vjust'
and:
typeerror: new() got unexpected keyword argument 'mapping'
just wondering if right way add together layer
plot rpy2, or if there's different idiom? thanks.
there different ways (answered in comments).
beside there bug in rpy2 preventing parameters parameters layer()
specified, (hopefully) fixed in both branches version_2.3.x
(will included release 2.3.3) , default
.
python r ggplot2 rpy2
No comments:
Post a Comment