-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Facet titles #974
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
Facet titles #974
Conversation
I like the idea. Can you please re-document and merge/rebase so I can do a review on cleaner code? (A bit of commit squashing wouldn't hurt either) |
efaa6b5
to
c6583c1
Compare
Here you go. |
@@ -174,6 +174,10 @@ print.theme <- function(x, ...) str(x) | |||
#' (\code{element_text}; inherits from \code{strip.text}) \cr | |||
#' strip.text.y \tab facet labels along vertical direction | |||
#' (\code{element_text}; inherits from \code{strip.text}) \cr | |||
#' strip.switch.pad.grid \tab space between strips and axes when strips are switched | |||
#' (\code{unit} \cr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing parens?
Overall, looks good. A few minor nit-picks inline. |
voilà |
as axes subtitles. Can be set to "x", "y" or "both" (the latter only | ||
for grids) to control which label strips are switched. (@lionel-) | ||
|
||
* `Geom` is now exported, making it easier to create new geoms in other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got messed up, but I can fix it.
Thanks! People are really going to like this feature |
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/ |
This implements a
switch_strips
argument tofacet_wrap
andfacet_grid
, which can be set tox
,y
orboth
(the latter only for grids). This allows to display the facet strips near the axes. They then act as axes subtitles. The padding between the switched strips and their corresponding axes can be adjusted through a new theme setting.Displaying the facet titles near the axes especially makes sense when the facet title directly characterize a change in the axis (for example, a transformation, a different measure, etc). This should be typically used in conjunction with a theme without boxes around the strips. I go over this in the updated documentation.
A grid facetting with strips switched to both axes:

A wrap facetting with free scales and strips switched to the x axis:
