Skip to content

Commit

Permalink
bug fix handling of missing APC values in gg_addReferenceLines
Browse files Browse the repository at this point in the history
  • Loading branch information
ri87nix committed Jul 5, 2023
1 parent 8e49c8a commit b876ce3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions R/plot_APCheatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,18 @@ gg_addReferenceLines <- function(gg_list, dimensions, plot_dat, markLines_list,
# create a dataset for the line segments
dat_segments <- lapply(markLines_list[[dim_3]], function(z) {

data.frame(x_start = case_when(dim_3 == "cohort" & dimensions[1] == "period" ~ min(plot_dat$y) + z,
dim_3 == "cohort" & dimensions[1] == "age" ~ min(plot_dat$y) - z,
dim_3 == "period" ~ z - min(plot_dat$y),
dim_3 == "age" & dimensions[1] == "cohort" ~ min(plot_dat$y) - z,
dim_3 == "age" & dimensions[1] == "period" ~ min(plot_dat$y) + z),
x_end = case_when(dim_3 == "cohort" & dimensions[1] == "period" ~ max(plot_dat$y) + z,
dim_3 == "cohort" & dimensions[1] == "age" ~ max(plot_dat$y) - z,
dim_3 == "period" ~ z - max(plot_dat$y),
dim_3 == "age" & dimensions[1] == "cohort" ~ max(plot_dat$y) - z,
dim_3 == "age" & dimensions[1] == "period" ~ max(plot_dat$y) + z),
y_start = min(plot_dat$y),
y_end = max(plot_dat$y),
data.frame(x_start = case_when(dim_3 == "cohort" & dimensions[1] == "period" ~ min(plot_dat$y, na.rm = TRUE) + z,
dim_3 == "cohort" & dimensions[1] == "age" ~ min(plot_dat$y, na.rm = TRUE) - z,
dim_3 == "period" ~ z - min(plot_dat$y, na.rm = TRUE),
dim_3 == "age" & dimensions[1] == "cohort" ~ min(plot_dat$y, na.rm = TRUE) - z,
dim_3 == "age" & dimensions[1] == "period" ~ min(plot_dat$y, na.rm = TRUE) + z),
x_end = case_when(dim_3 == "cohort" & dimensions[1] == "period" ~ max(plot_dat$y, na.rm = TRUE) + z,
dim_3 == "cohort" & dimensions[1] == "age" ~ max(plot_dat$y, na.rm = TRUE) - z,
dim_3 == "period" ~ z - max(plot_dat$y, na.rm = TRUE),
dim_3 == "age" & dimensions[1] == "cohort" ~ max(plot_dat$y, na.rm = TRUE) - z,
dim_3 == "age" & dimensions[1] == "period" ~ max(plot_dat$y, na.rm = TRUE) + z),
y_start = min(plot_dat$y, na.rm = TRUE),
y_end = max(plot_dat$y, na.rm = TRUE),
group = ifelse(match(z, markLines_list[[dim_3]]) == 1,
paste(capitalize_firstLetter(dim_3), z),
as.character(z)))
Expand Down

0 comments on commit b876ce3

Please sign in to comment.