# \donttest{
library(mlbplotR)
library(ggplot2)
# inherit top level aesthetics
ggplot(mtcars, aes(x = disp, y = mpg, h_var = mpg, v_var = disp)) +
geom_point() +
geom_median_lines() +
geom_mean_lines(color = "blue") +
theme_minimal()
# draw horizontal line only
ggplot(mtcars, aes(x = disp, y = mpg, h_var = mpg)) +
geom_point() +
geom_median_lines() +
geom_mean_lines(color = "blue") +
theme_minimal()
# draw vertical line only
ggplot(mtcars, aes(x = disp, y = mpg, v_var = disp)) +
geom_point() +
geom_median_lines() +
geom_mean_lines(color = "blue") +
theme_minimal()
# choose your own value
ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point() +
geom_median_lines(v_var = 400, h_var = 15) +
geom_mean_lines(v_var = 150, h_var = 30, color = "blue") +
theme_minimal()
# }
Run the code above in your browser using DataLab