user248237
user248237

Reputation:

How to set geom_point fill for ggplot in rpy2 from Python?

I'm making the following simple plot with ggplot using rpy2:

from rpy2.robjects.lib import ggplot2
from rpy2.robjects import r, Formula
# R iris dataset
iris = r('iris')
p = ggplot2.ggplot(iris) + \
    ggplot2.geom_point(ggplot2.aes_string(x="Sepal.Length", y="Sepal.Width", colour="Sepal.Width"), fill="white") + \
    ggplot2.facet_wrap(Formula('~ Species'), ncol=2, nrow = 2) 
p.plot()

It all works except the fill="white" part. I'd like the fill to be white for all the points while the colour (i.e. the point border colour) to be set by Sepal.Width. How can this be done? thanks.

Upvotes: 0

Views: 320

Answers (1)

lgautier
lgautier

Reputation: 11565

There is an obscure trick: it requires to set pch

See this answer: Place a border around points

Upvotes: 1

Related Questions