Skip to content

add an "outside" argument to geom_rug() to allow for moving rug tasse… #3085

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

Merged
merged 3 commits into from
Jan 19, 2019

Conversation

njtierney
Copy link
Contributor

…ls to outside the plot area

@thomasp85
Copy link
Member

Can I get you to run devtools::document() so the documentation gets updated

@njtierney
Copy link
Contributor Author

library(ggplot2)

# current behaviour with tassels inside figure area
ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_rug()

# move the tassels outside, remembering to turn off clipping
ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_rug(outside = TRUE) + 
  coord_cartesian(clip = "off")

# move the tassels to top right side, and expand margin
ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_rug(outside = TRUE,
           sides = "tr") + 
  coord_cartesian(clip = "off") +
  theme(plot.margin = margin(1,1,1,1, "cm"))

Created on 2019-01-19 by the reprex package (v0.2.1)

@njtierney njtierney closed this Jan 19, 2019
@njtierney njtierney reopened this Jan 19, 2019
@njtierney
Copy link
Contributor Author

Here's a reprex to demonstrate the behaviour:

library(ggplot2)

# current behaviour with tassels inside figure area
ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_rug()

# move the tassels outside, remembering to turn off clipping
ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_rug(outside = TRUE) + 
  coord_cartesian(clip = "off")

# move the tassels to top right side, and expand margin
ggplot(airquality,
       aes(x = Ozone,
           y = Solar.R)) + 
  geom_rug(outside = TRUE,
           sides = "tr") + 
  coord_cartesian(clip = "off") +
  theme(plot.margin = margin(1,1,1,1, "cm"))

Created on 2019-01-19 by the reprex package (v0.2.1)

@thomasp85 thomasp85 merged commit 3c3062d into tidyverse:master Jan 19, 2019
@karawoo
Copy link
Member

karawoo commented Jan 19, 2019

@njtierney If you're up for another PR I think it would be worth adding a test for this new behavior.

@njtierney
Copy link
Contributor Author

@karawoo - great idea! I'll get cracking on that now. :)

njtierney added a commit to njtierney/ggplot2 that referenced this pull request Jan 22, 2019
@lock
Copy link

lock bot commented Jul 18, 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 Jul 18, 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 this pull request may close these issues.

3 participants