From 7c92929cb7cc9ab8d3ac5c0456b7e168bb4a7320 Mon Sep 17 00:00:00 2001 From: Jason Everett Date: Fri, 31 Oct 2025 17:53:11 +1100 Subject: [PATCH] Fix error in target plotting code --- R/splnr_featureRep.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/splnr_featureRep.R b/R/splnr_featureRep.R index b5bda1d..291024e 100644 --- a/R/splnr_featureRep.R +++ b/R/splnr_featureRep.R @@ -539,7 +539,7 @@ splnr_plot_featureRep <- function(df, } - if (max(df$relative_held, na.rm = TRUE) < 1) { # Check max before multiplying + if (max(df$relative_held, na.rm = TRUE) <= 1) { # Check max before multiplying df <- df %>% dplyr::mutate( relative_held = .data$relative_held * 100, @@ -585,10 +585,11 @@ splnr_plot_featureRep <- function(df, ), na.rm = TRUE ) + - ggplot2::geom_bar( + ggplot2::geom_bar( # Add features in the df that had a zero or missing target data = df %>% dplyr::mutate(relative_held = dplyr::if_else(.data$incidental == FALSE, NA_real_, .data$relative_held)), # Use NA_real_ stat = "identity", position = "identity", - ggplot2::aes(x = .data$feature, y = .data$relative_held), na.rm = TRUE, fill = "NA", colour = "black" + ggplot2::aes(x = .data$feature, y = .data$relative_held), na.rm = TRUE, + fill = "NA", colour = "black" ) + ggplot2::labs(title = plotTitle, x = "Feature", y = "Representation of features \nin total selected area (%)") + ggplot2::theme_bw() +