-
Notifications
You must be signed in to change notification settings - Fork 2.1k
No ticks when the limit of Coord is in the opposite order to the Scale #3952
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
Comments
I think axis ticks should be drawn. Note that the problem exists even without library(ggplot2)
library(patchwork)
d <- data.frame(
x = 1:4,
y = 1:4
)
p <- ggplot(d, aes(x, y)) +
geom_point()
p1 <- p + coord_cartesian(ylim = c(1, 10))
p2 <- p + coord_cartesian(ylim = c(10, 1))
p1 / p2 Created on 2020-04-18 by the reprex package (v0.3.0) |
Oh, I didn't notice it... Thanks. |
Under the hood, this seems a problem of scale. Here, Line 19 in d3d47be
library(ggplot2)
scale <- scale_x_continuous()
scale$train(c(1, 3, 5))
scale$get_breaks(c(1, 5))
#> [1] 1 2 3 4 5
scale$get_breaks(c(5, 1))
#> [1] NA NA NA NA NA In addition, I have no idea what is the expected behaviour in the case below. Should this be errored...? d <- base::data.frame(
x = 1:4,
y = 1:4
)
p <- ggplot(d, aes(x, y)) +
geom_point()
p + scale_y_continuous(limits = c(10, 1))
#> Warning: Removed 4 rows containing missing values (geom_point). Created on 2020-04-22 by the reprex package (v0.3.0) |
(Originally reported at #3948)
Should the
p1
below be errored? Or, should the ticks be drawn?Created on 2020-04-19 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: