3131# ' }
3232# '
3333ggplotly <- function (p = ggplot2 :: last_plot(), width = NULL , height = NULL ,
34- tooltip = " all" , source = " A" ) {
34+ tooltip = " all" , source = " A" , ... ) {
3535 UseMethod(" ggplotly" , p )
3636}
3737
3838# ' @export
3939ggplotly.ggmatrix <- function (p = ggplot2 :: last_plot(), width = NULL ,
40- height = NULL , tooltip = " all" , source = " A" ) {
40+ height = NULL , tooltip = " all" , source = " A" , ... ) {
4141 plotList <- list ()
4242 for (i in seq_len(p $ nrow )) {
4343 for (j in seq_len(p $ ncol )) {
@@ -47,14 +47,14 @@ ggplotly.ggmatrix <- function(p = ggplot2::last_plot(), width = NULL,
4747 # TODO:
4848 # (1) how to show x/y titles? Should these be arguments in subplot?
4949 # (2) it only makes since to share axes on the lower diagonal
50- l <- get_plot(do.call(subplot , c(plotList , list (nrows = p $ nrow ))))
50+ l <- get_plot(do.call(subplot , c(plotList , list (nrows = p $ nrow , ... ))))
5151 l $ layout $ title <- p $ title
5252 hash_plot(p $ data , l )
5353}
5454
5555# ' @export
5656ggplotly.ggplot <- function (p = ggplot2 :: last_plot(), width = NULL ,
57- height = NULL , tooltip = " all" , source = " A" ) {
57+ height = NULL , tooltip = " all" , source = " A" , ... ) {
5858 l <- gg2list(p , width = width , height = height , tooltip = tooltip , source = source )
5959 hash_plot(p $ data , l )
6060}
@@ -67,9 +67,10 @@ ggplotly.ggplot <- function(p = ggplot2::last_plot(), width = NULL,
6767# ' tooltip. The default, "all", means show all the aesthetic tooltips
6868# ' (including the unofficial "text" aesthetic).
6969# ' @param source Only relevant for \link{event_data}.
70+ # ' @param ... currently not used
7071# ' @return a 'built' plotly object (list with names "data" and "layout").
7172# ' @export
72- gg2list <- function (p , width = NULL , height = NULL , tooltip = " all" , source = " A" ) {
73+ gg2list <- function (p , width = NULL , height = NULL , tooltip = " all" , source = " A" , ... ) {
7374 # ------------------------------------------------------------------------
7475 # Our internal version of ggplot2::ggplot_build(). Modified from
7576 # https://github.com/hadley/ggplot2/blob/0cd0ba/R/plot-build.r#L18-L92
@@ -469,6 +470,8 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
469470 col_txt <- paste(
470471 p $ facet $ labeller(lay [names(p $ facet [[col_vars ]])]), collapse = " , "
471472 )
473+ if (is_blank(theme [[" strip.text.x" ]])) col_txt <- " "
474+ if (inherits(p $ facet , " grid" ) && lay $ ROW != 1 ) col_txt <- " "
472475 if (nchar(col_txt ) > 0 ) {
473476 col_lab <- make_label(
474477 col_txt , x = mean(xdom ), y = max(ydom ),
@@ -482,6 +485,8 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
482485 row_txt <- paste(
483486 p $ facet $ labeller(lay [names(p $ facet $ rows )]), collapse = " , "
484487 )
488+ if (is_blank(theme [[" strip.text.y" ]])) row_txt <- " "
489+ if (inherits(p $ facet , " grid" ) && lay $ COL != nCols ) row_txt <- " "
485490 if (nchar(row_txt ) > 0 ) {
486491 row_lab <- make_label(
487492 row_txt , x = max(xdom ), y = mean(ydom ),
0 commit comments