Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing alpha to geom_mean_lines #10

Closed
guga31bb opened this issue Oct 1, 2021 · 2 comments · Fixed by #13
Closed

passing alpha to geom_mean_lines #10

guga31bb opened this issue Oct 1, 2021 · 2 comments · Fixed by #13

Comments

@guga31bb
Copy link
Member

guga31bb commented Oct 1, 2021

Describe the bug
alpha doesn't do anything

@mrcaseb
Copy link
Member

mrcaseb commented Oct 1, 2021

Wow this is very weird as the alpha actually works but it seems to be necessary to divide it by ten compared to typical values

library(nflplotR)
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", alpha = 0.03) +
  theme_minimal()

Created on 2021-10-01 by the reprex package (v2.0.1)

@mrcaseb
Copy link
Member

mrcaseb commented Oct 1, 2021

Here is a comparison between nflplotR and the standard geom_hline in ggplot2

library(nflplotR)
library(ggplot2)

# use same alpha in nflplotr and ggplot
ggplot(mtcars, aes(x = disp, y = mpg)) +
  geom_point() +
  geom_median_lines(aes(h_var = mpg), color = "blue", alpha = 0.1) +
  geom_hline(aes(yintercept = mean(mpg)), color = "red", linetype = 2, alpha = 0.1) +
  theme_minimal()

# use factor ten smaller in nflplotr WTF
ggplot(mtcars, aes(x = disp, y = mpg)) +
  geom_point() +
  geom_median_lines(aes(h_var = mpg), color = "blue", alpha = 0.01) +
  geom_hline(aes(yintercept = mean(mpg)), color = "red", linetype = 2, alpha = 0.1) +
  theme_minimal()

Created on 2021-10-01 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants