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

Strange dataset dependent grouping effect #266

Closed
clauswilke opened this issue Jan 7, 2019 · 3 comments
Closed

Strange dataset dependent grouping effect #266

clauswilke opened this issue Jan 7, 2019 · 3 comments

Comments

@clauswilke
Copy link
Contributor

@clauswilke clauswilke commented Jan 7, 2019

This works:

library(ggplot2)
library(ungeviz)    # devtools::install_github("wilkelab/ungeviz")
library(gganimate)

ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
  geom_point() +
  stat_smooth_draws(
    times = 10,
    formula = y ~ x,
    aes(group = interaction(stat(.draw), colour)),
    size = 1.5
  ) +
  theme_bw() + theme(legend.position = "bottom") + 
  transition_states(stat(.draw), 1, 2) +
  enter_fade() + exit_fade()

iris

This doesn't (lines are now connected):

ggplot(mtcars, aes(disp, mpg, colour = factor(cyl))) +
  geom_point() +
  stat_smooth_draws(
    times = 10,
    formula = y ~ x,
    aes(group = interaction(stat(.draw), colour)),
    size = 1.5
  ) +
  theme_bw() + theme(legend.position = "bottom") + 
  transition_states(stat(.draw), 1, 2) +
  enter_fade() + exit_fade()

mtcars

Notice that the only difference is the data set. I have tried as.character(cyl) instead of factor(cyl) to see if the problem is the numeric variable turned into a factor, and it makes no difference.

@thomasp85 thomasp85 closed this in a326ce9 Jan 7, 2019
@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Jan 7, 2019

At least you can't complain the fixes aren't coming fairly quickly :-)

Loading

@clauswilke
Copy link
Contributor Author

@clauswilke clauswilke commented Jan 7, 2019

I'm not complaining. Thanks for all your effort on this. shadow_mark() looks much better now with geom_smooth()!

Loading

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Jan 7, 2019

Dont worry - just joking 🙃

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants