Skip to content

coord_cartesian() fails without reversed limits with scale_y_reverse() #3910

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

Closed
JWiley opened this issue Mar 24, 2020 · 1 comment
Closed

Comments

@JWiley
Copy link

JWiley commented Mar 24, 2020

In 3.3.0 (including latest dev version), there is odd behavior when combining coord_cartesian() with scale_y_reverse().

This is fine:

ggplot(mtcars, aes(mpg, hp)) + 
  geom_point() + 
  coord_cartesian(xlim = c(10, 35), ylim = c(50, 350))

image

This also is fine:

ggplot(mtcars, aes(mpg, hp)) + 
  geom_point() + 
  scale_y_reverse() + 
  coord_cartesian(xlim = c(10, 35))

image

This breaks. I'm inclined to see it as a bug, because even if you think I should reverse the lower and upper limit of ylim given the use of scale_y_reverse(), why should that error make the axis ticks, etc. disappear altogether for the y axis?

ggplot(mtcars, aes(mpg, hp)) + 
  geom_point() + 
  scale_y_reverse() + 
  coord_cartesian(xlim = c(10, 35), ylim = c(50, 350))

image

Interestingly, this is fine again.

ggplot(mtcars, aes(mpg, hp)) + 
  geom_point() + 
  scale_y_reverse() + 
  coord_cartesian(xlim = c(10, 35), ylim = c(350, 50))

image

@yutannihilation
Copy link
Member

Sorry, I didn't notice this issue... Let me close this in favor of #3952.

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

2 participants