From 309938d22e353854be700cce80a1c146839b3bb6 Mon Sep 17 00:00:00 2001 From: awd97 <=> Date: Thu, 17 Feb 2022 16:00:41 +0000 Subject: [PATCH] fixed null plotly annotations bug --- R/seaMass.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/seaMass.R b/R/seaMass.R index 54bfe10..73b1c51 100644 --- a/R/seaMass.R +++ b/R/seaMass.R @@ -857,7 +857,8 @@ setMethod("plot_robust_pca", "seaMass", function( } suppressWarnings(fig <- plotly::ggplotly(g, tooltip = c("text", "x", "y"), dynamicTicks = T, width = width, height = height)) - for (i in 1:length(fig$x$layout$annotations)) fig$x$layout$annotations[[i]]$y <- fig$x$layout$annotations[[i]]$y - 0.05 # another grim plotly hack + if (!is.null(fig$x$layout$annotations)) + for (i in 1:length(fig$x$layout$annotations)) fig$x$layout$annotations[[i]]$y <- fig$x$layout$annotations[[i]]$y - 0.05 # another grim plotly hack return(fig) })