Hi guys,
@Technocrat helped me by providing me code for a linear regression model and when I got it to work, I noticed the data was quite choppy. How could I go about cleaning it up and adding things like color, font and size to it?
Hi guys,
@Technocrat helped me by providing me code for a linear regression model and when I got it to work, I noticed the data was quite choppy. How could I go about cleaning it up and adding things like color, font and size to it?
the code is as follows:
Linear Regression Plot
it <- glm(strikes ~ release_speed + release_spin_rate, data = yankees, family = "binomial")
Using the {ggplot2}
package there's quite a bit you can do with model plotting. For example
library(ggplot2)
fit <- lm(mpg ~ drat, data = mtcars)
ggplot(mtcars,aes(drat,mpg)) + geom_smooth(method = "lm") + theme_minimal()
#> `geom_smooth()` using formula 'y ~ x'
However, when the y-axis is binary, it ends up looking more like
It's possible to get to something more like
but getting there isn't simple. See this explainer.
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.