Skip to content

geom_rug and coord_flip do not work together #2987

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
has2k1 opened this issue Nov 9, 2018 · 1 comment · Fixed by #2988
Closed

geom_rug and coord_flip do not work together #2987

has2k1 opened this issue Nov 9, 2018 · 1 comment · Fixed by #2988

Comments

@has2k1
Copy link
Contributor

has2k1 commented Nov 9, 2018

library(ggplot2)

df <- data.frame(x=1:10, y=(1:10)^3)
g <- ggplot(df, aes(x, y)) + geom_point() + geom_rug(sides='l')

# Normal plot
g

# coord_flip does not flip the rugs
g + coord_flip()

Created on 2018-11-08 by the reprex package (v0.2.1)

Problem

The location of the rugs is contained in the sides parameter of geom_rug. The parameters of a geom are not passed to the coordinate system and so it cannot manipulate them.

has2k1 added a commit to has2k1/ggplot2 that referenced this issue Nov 9, 2018
The rugs in `geom_rug` are drawn along an axis depending the
`sides` parameter. Since the coordinate system does not alter
the `geom` parameters, the `geom` has to alter any parameters
that determine where the geoms are plotted.

fixes tidyverse#2987
clauswilke pushed a commit that referenced this issue Nov 11, 2018
* Fix geom_rug + coord_flip

The rugs in `geom_rug` are drawn along an axis depending the
`sides` parameter. Since the coordinate system does not alter
the `geom` parameters, the `geom` has to alter any parameters
that determine where the geoms are plotted.

fixes #2987

* Explain why geom_rug flips the sides
@lock
Copy link

lock bot commented May 10, 2019

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 10, 2019
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.

1 participant