Skip to content

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

Closed

Description

@yutannihilation

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)

Activity

  1. added a commit that references this issue on Nov 4, 2019
    5276609
  2. thomasp85 commented on Nov 4, 2019

    @thomasp85
    Member

    Good catch

  3. added a commit that references this issue on Nov 14, 2019
    5f7d696
  4. lock commented on May 20, 2020

    @lock

    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/

  5. lock commented on May 20, 2020

    @lock

    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/

  6. locked and limited conversation to collaborators on May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions