Skip to content

Example of flipped aes on geom_area() needs orientation? #3590

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
yutannihilation opened this issue Oct 27, 2019 · 3 comments · Fixed by #3605
Closed

Example of flipped aes on geom_area() needs orientation? #3590

yutannihilation opened this issue Oct 27, 2019 · 3 comments · Fixed by #3605

Comments

@yutannihilation
Copy link
Member

The third figure on the examples section of geom_ribbon/geom_area seems a bit confusing to me.

cc @thomasp85

The comment says

# Change orientation be switching the mapping

and I expected the left one below, but actually got the right one. Is the figure intended? Or, is this an example of failure to show the necessity of explicitly setting orientation = "y"?

library(ggplot2)

huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))

# expected one?
p1 <- ggplot(huron) +
  geom_area(aes(x = year, y = level)) +
  coord_flip() +
  ggtitle("flipped by coord")

# orientation = "y"?
p2 <- ggplot(huron) +
  geom_area(aes(x = level, y = year)) +
  ggtitle("flipped by aes")

patchwork::wrap_plots(p1, p2)

Created on 2019-10-27 by the reprex package (v0.3.0)

@thomasp85
Copy link
Member

Good catch

@lock
Copy link

lock bot commented May 20, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

1 similar comment
@lock
Copy link

lock bot commented May 20, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants