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

geom_xspline only works on properly arranged data frames #72

Open
tjebo opened this issue Jan 1, 2021 · 0 comments
Open

geom_xspline only works on properly arranged data frames #72

tjebo opened this issue Jan 1, 2021 · 0 comments

Comments

@tjebo
Copy link

tjebo commented Jan 1, 2021

This behaviour is not really clear from the documentation. It would help to have this information added.
(or change the underlying Stat to first arrange by x value.)

Example (partly taken from the documentation example:

library(ggplot2)
library(ggalt)

set.seed(1492)
dat <- data.frame(x=c(1:10, 1:10, 1:10),
                  y=c(sample(15:30, 10), 2*sample(15:30, 10),
                      3*sample(15:30, 10)),
                  group=factor(c(rep(1, 10), rep(2, 10), rep(3, 10)))
)

newdat <- dat[1:10,]

ggplot(newdat, aes(x, y)) +
  geom_point(color="black") +
  geom_xspline(size=0.5)

weirddat <- newdat[sample(nrow(newdat)), ]

ggplot(weirddat, aes(x, y)) +
  geom_point(color="black") +
  geom_xspline(size=0.5)

Created on 2021-01-01 by the reprex package (v0.3.0)

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