ggpmisc
ggpmisc copied to clipboard
Spacing of "text" output in `stat_poly_eq()`
The spacing of "text" output in stat_poly_eq() could be improved. Possibly, best is not to include the asterisk.
See question at Stackoverflow. The code below could work as a possible answer.
df <- data.frame(x = c(1:100))
df$y <- 20 + 30 * df$x + rnorm(100, sd = 80)
library(ggpmisc)
#> Loading required package: ggpp
#> Loading required package: ggplot2
#>
#> Attaching package: 'ggpp'
#> The following object is masked from 'package:ggplot2':
#>
#> annotate
ggplot(df, aes(x, y)) +
geom_point() +
stat_poly_line(method = "lm", se = FALSE) +
stat_poly_eq(use_label(c("eq", "R2"), sep = ", "), output.type = "text")

Created on 2022-09-06 with reprex v2.0.2