Skip to content

Commit

Permalink
Fix #89
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Jul 14, 2023
1 parent 1aa686c commit 36c222c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ggh4x (development version)

* Swapped inheritance of `facet_nested(nest_line)`: it is now a line element
that inherits from blank elements, and the theme default is a blank element.
This makes it more responsive to the theme setting (#89).
* Anticipated compatability with future ggplot2 > 3.4.2.
* `force_panelsizes()` gains a `total_width` and `total_height` argument to
set the size of the total panel area.
Expand Down
8 changes: 5 additions & 3 deletions R/facet_nested.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ facet_nested <- function(
switch = NULL,
drop = TRUE,
margins = FALSE,
nest_line = element_blank(),
nest_line = element_line(inherit.blank = TRUE),
resect = unit(0, "mm"),
strip = strip_nested(),
bleed = NULL
Expand Down Expand Up @@ -234,13 +234,15 @@ FacetNested <- ggproto(
add_nest_indicator <- function(panels, params, theme) {
# Convert nest line to proper element
nest_line <- params$nest_line
if (is.null(nest_line) || isFALSE(nest_line) ||
inherits(nest_line, "element_blank")) {
if (is.null(nest_line) || isFALSE(nest_line)) {
return(panels)
}
nest_line <- inherit_element(
nest_line, calc_element("ggh4x.facet.nestline", theme)
)
if (inherits(nest_line, "element_blank")) {
return(panels)
}

# Find strips
layout <- panels$layout
Expand Down
2 changes: 1 addition & 1 deletion R/themes.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' used in the [`guide_axis_logticks()`] function. Defaults to `rel(1/3)`.
ggh4x_theme_elements <- function() {
register_theme_elements(
ggh4x.facet.nestline = element_line(),
ggh4x.facet.nestline = element_blank(),
ggh4x.axis.nestline = element_line(),
ggh4x.axis.nestline.x = element_line(),
ggh4x.axis.nestline.y = element_line(),
Expand Down

0 comments on commit 36c222c

Please sign in to comment.