Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Add inherit.blank argument to element constructors #1754
Conversation
hadley
added the
in progress
label
Sep 16, 2016
|
This seems like a reasonable approach to me |
|
@hadley can you review? Now you can do stuff like this (not a beautiful plot but an example): p + theme_minimal() + theme(line = element_blank(), axis.line.y = element_line()) |
|
What if we automatically set |
| @@ -13,6 +13,8 @@ | ||
| #' @param fill Fill colour. | ||
| #' @param colour,color Line/border colour. Color is an alias for colour. | ||
| #' @param size Line/border size in mm; text size in pts. | ||
| +#' @param inherit.blank Should this element inherit the existence of an | ||
| +#' element_blank among its parents? |
hadley
Sep 17, 2016
Owner
Can you expand on this a little bit? I assume if it's TRUE the "blank-ness" will be inherited, otherwise it will skip the parent and look at the grand parent?
| - | ||
| + if (is.null(e2) || inherits(e1, "element_blank")) return(e1) | ||
| + # If e1 is NULL inherit everything from e2 | ||
| + if (is.null(e1)) return(e2) | ||
| # If e1 is NULL, or if e2 is element_blank, inherit everything from e2 |
thomasp85
self-assigned this
Sep 17, 2016
|
Edit: Just saw you updated your repo, but the following has not changed. Can you confirm my first example with your local branch? I like this idea. It would prevent the recursive checking that #1581 requires, but your example doesn't seem to work for me.
When I examine the plot theme, it seems When I try Examining the plot, I see
|
|
This has been fixed I think - truly with the latest version |
|
I cannot confirm any problems and all changes has been pushed - can you try again and make sure you create the plot object from scratch |
|
LGTM |
|
@thomasp85 Sorry, I previewed the comment but apparently never posted it. Yes, I've found no problems with the last update! |




thomasp85 commentedSep 16, 2016
This PR is an alternative fix to #1555, #1557, #1565, and #1567 compared to #1581.
It will propose the inclusion of an
inherit.blankargument to theelement_*constructors. The reason for this is that we might want to suppress drawing of a parent element and all its children, and then reenable some of the children again. This requires element calculation to sometimes ignoreelement_blank()and sometimes not. The default should beinherit.blank = FALSEwhile elements in the included themes should haveinherit.blank = TRUEinstead.