Skip to content

Commit 9bcee73

Browse files
committed
fixes for R CMD check; ensure subplot populates a legend
1 parent cbdc93c commit 9bcee73

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

R/subplots.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
#' economics_long %>%
4141
#' split(.$variable) %>%
4242
#' map(~ plot_ly(., x = ~date, y = ~value)) %>%
43-
#' subplot(nrows = NROW(.), shareX = T)
43+
#' subplot(nrows = NROW(.), shareX = TRUE)
4444
#'
4545
#' # or pass a tibble with a list-column of plotly objects
4646
#' economics_long %>%
4747
#' group_by(variable) %>%
4848
#' do(p = plot_ly(., x = ~date, y = ~value)) %>%
49-
#' subplot(nrows = NROW(.), shareX = T)
49+
#' subplot(nrows = NROW(.), shareX = TRUE)
5050
#'
5151
#' # learn more at https://cpsievert.github.io/plotly_book/subplot.html
5252
#'

man/subplot.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-plotly-subplot.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@ test_that("group + [x/y]axis works", {
4545
expect_true(all(1 >= xdom[[3]] & xdom[[3]] > 2/3))
4646
})
4747

48-
test_that("shareX produces one x-axis", {
48+
test_that("shareX produces one x-axis and a legend", {
4949
s <- subplot(plot_ly(x = 1), plot_ly(x = 1), nrows = 2, shareX = TRUE)
5050
l <- expect_traces(s, 2, "shareX")
5151
expect_true(sum(grepl("^xaxis", names(l$layout))) == 1)
52+
expect_true(l$data[[1]]$showlegend %||% TRUE)
53+
expect_true(l$data[[2]]$showlegend %||% TRUE)
54+
expect_true(l$layout$showlegend %||% TRUE)
5255
})
5356

5457
test_that("shareY produces one y-axis", {

0 commit comments

Comments
 (0)