From 69b018e042ad2488758719115b9ffdcaa46519e0 Mon Sep 17 00:00:00 2001 From: ms609-agent <313734811+ms609-agent@users.noreply.github.com> Date: Wed, 2 Sep 2026 10:07:56 +0100 Subject: [PATCH] Don't attach plotly in landscapes vignette `library("plotly")` in landscapes.Rmd put `plotly::layout()` on the search path. Where vignettes are re-built in a shared R session, this masked `graphics::layout()` in the subsequently built treespace.Rmd, whose `plot-mapping-5d` chunk failed with no applicable method for 'layout' applied to an object of class "c('double', 'numeric')" Use `plotly::` prefixes instead, and qualify `graphics::layout()` in treespace.Rmd so the chunk is robust to any future masking. Co-Authored-By: Claude Opus 5 --- vignettes/landscapes.Rmd | 6 +++--- vignettes/treespace.Rmd | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vignettes/landscapes.Rmd b/vignettes/landscapes.Rmd index 70d7a5875..b9e23050d 100644 --- a/vignettes/landscapes.Rmd +++ b/vignettes/landscapes.Rmd @@ -115,9 +115,9 @@ A variety of R add-on packages facilitate three-dimensional plots. ```{r plot-3d, message = FALSE} if (requireNamespace("plotly", quietly = TRUE)) { - library("plotly", quietly = TRUE) - fig <- plot_ly(x = x, y = y, z = z) - fig <- fig %>% add_surface() + # Don't attach plotly: it would mask `graphics::layout()` in later vignettes + fig <- plotly::plot_ly(x = x, y = y, z = z) + fig <- plotly::add_surface(fig) fig } else { print("Run `install.packages('plotly')` to view this output") diff --git a/vignettes/treespace.Rmd b/vignettes/treespace.Rmd index 62e2bbec5..3c18cdfea 100644 --- a/vignettes/treespace.Rmd +++ b/vignettes/treespace.Rmd @@ -293,7 +293,7 @@ plotSeq <- matrix(0, nDim, nDim) plotSeq[upper.tri(plotSeq)] <- seq_len(nDim * (nDim - 1) / 2) plotSeq <- t(plotSeq[-nDim, -1]) plotSeq[nDim * 1:3] <- (nDim * (nDim - 1) / 2) + 1:3 -layout(plotSeq) +graphics::layout(plotSeq) par(mar = rep(0.1, 4)) for (i in 2:nDim) for (j in seq_len(i - 1)) {