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

geom_rug and coord_flip do not work together #2987

Closed
has2k1 opened this Issue Nov 9, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@has2k1
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

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 tidyverse#2987

clauswilke added a commit that referenced this issue Nov 11, 2018

Fix geom_rug + coord_flip (#2988)
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment