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

Surprising failure with xlim #14

Open
hughjonesd opened this issue May 21, 2023 · 1 comment
Open

Surprising failure with xlim #14

hughjonesd opened this issue May 21, 2023 · 1 comment

Comments

@hughjonesd
Copy link
Owner

hughjonesd commented May 21, 2023

Example:

library(ggplot2)
ggp <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species, shape = Species))
ggp2 <- ggp + geom_point()

from <- c(2.5, 3.0, 5.5, 6.0)
to <- c(3.5, 4.5, 4.5, 5.5)
ggp2 + xlim(2,5) + geom_magnify(aes(from = Species=="versicolor" & Sepal.Length < 6), to = c(4, 4.8, 5, 6))

This doesn't print a magnified inset, and gives a warning about dropped cases.

The failure is because xmin becomes NA in the data, which then leads all cases to be dropped as incomplete.

Not sure why xmin is becoming NA. It's fine with xlim(1.9, 5) ; or with expand = 0.

@hughjonesd
Copy link
Owner Author

StatMagnify unsurprisingly sets xmin to 1.94. Then some time before the geom, that 1.94 becomes NA in the data.

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