Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
  • Loading branch information
trekonom and cpsievert authored Sep 6, 2024
1 parent 9352fd4 commit 805193b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -917,15 +917,12 @@ gg2list <- function(p, width = NULL, height = NULL,
# facet strips -> plotly annotations
if (has_facet(plot)) {
col_vars <- ifelse(inherits(plot$facet, "FacetWrap"), "facets", "cols")
col_txt <- if (!length(names(plot$facet$params[[col_vars]])) == 0) {
paste(
plot$facet$params$labeller(
lay[names(plot$facet$params[[col_vars]])]
), collapse = br()
)
} else {
""
}
col_txt <- paste(
plot$facet$params$labeller(
lay[names(plot$facet$params[[col_vars]])]
), collapse = br()
)
if (length(names(plot$facet$params[[col_vars]])) == 0) col_txt <- ""
if (is_blank(theme[["strip.text.x"]])) col_txt <- ""
if (inherits(plot$facet, "FacetGrid") && lay$ROW != 1) col_txt <- ""
if (robust_nchar(col_txt) > 0) {
Expand Down

0 comments on commit 805193b

Please sign in to comment.