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

afex_plot with geom_jitter crashes when "color" is supplied within data_arg and mapping = "color" #88

Open
FBartos opened this issue Jul 9, 2020 · 0 comments

Comments

@FBartos
Copy link

FBartos commented Jul 9, 2020

Hi Henrik,

it's impossible to change the color of background data when mapping is set to "color" only. (I would've expected different color of the CI bars and same color of the background points)

library("afex")
model <- mixed(value ~ gender * treatment  + (1|id), data=afex::obk.long, method = "S")

data_arg <- list(
  position =
    ggplot2::position_jitterdodge(
      jitter.width  = 0.3,
      jitter.height = 0,
      dodge.width   = 0.3
    ),
  color = "red"
)

afex::afex_plot(
  model,
  dv          = "value",
  x           = "gender",
  trace       = "treatment",
  id          = "id",
  data_geom   = ggplot2::geom_jitter,
  mapping     = "color",
  error       = "model",
  data_arg    = data_arg
)

Error: 'position_jitterdodge()' requires at least one aesthetic to dodge by

However, adding "linetype" to the mapping removes the error and produces the expected figure.

afex::afex_plot(
  model,
  dv          = "value",
  x           = "gender",
  trace       = "treatment",
  id          = "id",
  data_geom   = ggplot2::geom_jitter,
  mapping     = c("color", "linetype"),
  error       = "model",
  data_arg    = data_arg
)

image

Best,
František

@FBartos FBartos changed the title afex_plot with geom_jitter crashes when "color" is supplied withing data_arg and mapping = "color" afex_plot with geom_jitter crashes when "color" is supplied within data_arg and mapping = "color" Jul 9, 2020
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

No branches or pull requests

1 participant