Issue #38
resolved
For my formula without a y-intercept, y ~ x + 0, labels are being output as y = 3.25 instead of y = 3.25 x. It does not matter if I specify anything for eq.x.rhs. Am I doing something incorrectly?
rm(list=ls()) library(dplyr) library(ggplot2) library(ggpmisc) set.seed(1234) x <- 1:100 scale <- 3.25 y <- scale * x + rnorm(length(x), mean = 0, sd = 5) formula <- y ~ x + 0 data.frame(x, y) %>% ggplot(aes(x, y)) + geom_point() + geom_smooth(method = 'lm', formula = formula) + ggpmisc::stat_poly_eq(aes(label = ..eq.label..), formula = formula, parse = TRUE) -> p1
Comments (2)
-
-
repo owner - changed status to resolved
Seems to have been a "false alarm", so I am closing this issue.
- Log in to comment
I had missed that the help for stat_poly_eq does say to use “-1” or “- 1” to specify no intercept, rather than “+ 0”.
produces an appropriate label.
Thanks, and feel free to close this issue!