Skip to content

Commit 4e8434a

Browse files
authored
Merge pull request #144 from SpatialPlanning/devel
Fix error in target plotting code
2 parents 7ce7c11 + 7c92929 commit 4e8434a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/splnr_featureRep.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ splnr_plot_featureRep <- function(df,
539539
}
540540

541541

542-
if (max(df$relative_held, na.rm = TRUE) < 1) { # Check max before multiplying
542+
if (max(df$relative_held, na.rm = TRUE) <= 1) { # Check max before multiplying
543543
df <- df %>%
544544
dplyr::mutate(
545545
relative_held = .data$relative_held * 100,
@@ -585,10 +585,11 @@ splnr_plot_featureRep <- function(df,
585585
),
586586
na.rm = TRUE
587587
) +
588-
ggplot2::geom_bar(
588+
ggplot2::geom_bar( # Add features in the df that had a zero or missing target
589589
data = df %>% dplyr::mutate(relative_held = dplyr::if_else(.data$incidental == FALSE, NA_real_, .data$relative_held)), # Use NA_real_
590590
stat = "identity", position = "identity",
591-
ggplot2::aes(x = .data$feature, y = .data$relative_held), na.rm = TRUE, fill = "NA", colour = "black"
591+
ggplot2::aes(x = .data$feature, y = .data$relative_held), na.rm = TRUE,
592+
fill = "NA", colour = "black"
592593
) +
593594
ggplot2::labs(title = plotTitle, x = "Feature", y = "Representation of features \nin total selected area (%)") +
594595
ggplot2::theme_bw() +

0 commit comments

Comments
 (0)