Skip to content

Allow PositionStack to specify the directions on negatives and positives seperately #3607

Closed

Description

@yutannihilation

Context: I need this to finish #3529 (comment)

PositionStack allows to flip the stacking direction by reverse parameter, but it forces the data on the positive side and on the negative side have the same direction.

ggplot2/R/position-stack.r

Lines 191 to 204 in 528a374

if (any(negative)) {
neg <- collide(neg, NULL, "position_stack", pos_stack,
vjust = params$vjust,
fill = params$fill,
reverse = params$reverse
)
}
if (any(!negative)) {
pos <- collide(pos, NULL, "position_stack", pos_stack,
vjust = params$vjust,
fill = params$fill,
reverse = params$reverse
)
}

However, it's not a rare case we want to stack them in the opposite direction (i.e. reverse the direction only on the negative side) to draw data properly. geom_area() is the very example for this. I wonder if PositionStack can accept these.

For the interface, I don't come up with a nice idea yet, but it would be something like:

geom_area(
  position = position_stack(reverse = c(positive = FALSE, positive = TRUE))
)

or

geom_area(
  position = position_stack(reverse = TRUE, mirrored = TRUE)
)

Activity

  1. yutannihilation commented on Dec 17, 2019

    @yutannihilation
    MemberAuthor

    Superseded by #3673

  2. lock commented on Jun 24, 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/

  3. locked and limited conversation to collaborators on Jun 24, 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