Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5212.

Briefly, it adds more options for the dir argument to layout the panels in various ways. The as.table argument gets absorbed into dir when the previous way of declaring dir = "v" or dir = "h" is used.

The new options for dir are:

  • "lt": start in the top-left, start filling left-to-right.
  • "tl": start in the top-left, start filling top-to-bottom.
  • "lb": start in the bottom-left, start filling left-to-right.
  • "bl": start in the bottom-left, start filling bottom-to-top.
  • "rt": start in the top-right, start filling right-to-left.
  • "tr": start in the top-right, start filling top-to-bottom.
  • "rb": start in the bottom-right, start filling right-to-left.
  • "br" start in the bottom-right, start filling bottom-to-top

Using as.table with any of the options above has no effect.

As an example where blank panels are set at the beginning:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  facet_wrap(~ class, dir = "rb")

Created on 2024-04-22 with reprex v2.1.0

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Maybe add an example with the new features

@teunbrand
Copy link
Collaborator Author

Good idea thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: allow blank panels of facet_wrap() to be at the beginning
2 participants