Skip to content

Commit d0c3057

Browse files
committed
remove every axis title; account for interior strips in facet_wrap()
1 parent 64f9170 commit d0c3057

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

R/ggplotly.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
277277
theme[["strip.text.x"]] %||% theme[["strip.text"]],
278278
"npc", "height"
279279
)
280+
panelMarginY <- panelMarginY + stripSize
280281
# space for ticks/text in free scales
281282
if (p$facet$free$x) {
282283
axisTicksX <- unitConvert(
@@ -307,7 +308,6 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
307308
rep(panelMarginX, 2),
308309
rep(panelMarginY, 2)
309310
)
310-
311311
doms <- get_domains(nPanels, nRows, margins)
312312

313313
for (i in seq_len(nPanels)) {
@@ -414,7 +414,6 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
414414
}
415415
# facets have multiple axis objects, but only one title for the plot,
416416
# so we empty the titles and try to draw the title as an annotation
417-
gglayout[[axisName]]$title <- ""
418417
if (nchar(axisTitleText) > 0) {
419418
# npc is on a 0-1 scale of the _entire_ device,
420419
# but these units _should_ be wrt to the plotting region
@@ -432,6 +431,11 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
432431
}
433432
}
434433
}
434+
435+
if (has_facet(p)) {
436+
gglayout[[axisName]]$title <- ""
437+
}
438+
435439
} # end of axis loop
436440

437441
xdom <- gglayout[[lay[, "xaxis"]]]$domain

0 commit comments

Comments
 (0)