What's the syntax for geom_smooth with binomial family?
bhvieira opened this issue · comments
Bruno Hebling Vieira commented
This does not work:
# example
x = np.linspace(0, 1, 100)
y = np.random.binomial(1, 0.5, 100)
dat = pd.DataFrame({"x": x, "y": y})
ggplot(dat, aes(x="x", y="y")) + geom_point() + geom_smooth(method="glm", method_args={"family": "binomial"})
Returns AttributeError: 'str' object has no attribute 'link'
The analogue in R works like:
library(ggplot2)
x <- seq(0, 1, length=100)
y <- rbinom(100, 1, 0.5)
dat <- data.frame(x=x, y=y)
ggplot(dat, aes(x=x, y=y)) + geom_point() + geom_smooth(method="glm", method.args=list(family="binomial"))
Info:
- plotnine: 0.10.1
- python: 3.10.2
Bruno Hebling Vieira commented
I see I'm in a fairly old version, so perhaps this has been fixed. I can test later, so sorry in advance if that is the case.
Bruno Hebling Vieira commented
Tested again after updating, still occurs
Info:
- plotnine: 0.13.4
- python: 3.10.2