Skip to content

Commit

Permalink
Remove outliers from boxplot when jitter is plotted
Browse files Browse the repository at this point in the history
  • Loading branch information
TuomasBorman committed Jun 3, 2024
1 parent 5779a67 commit 4502db7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions R/plot_central.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,15 @@ NULL
} else {
box_args <- list(mapping=aes(fill=.data[[fill_by]]))
}
box_args <- c(box_args, list(colour = "black", alpha = 0.2))
# If user wants that jitter plot is not added, add outliers.
# Otherwise remove outliers since then they would be plotted twice;
# once as outlier and once as part of jitter plot.
if( !is.na(point_shape) ){
box_args[["outlier.shape"]] <- NA
}
plot_out <- plot_out +
do.call(
geom_boxplot,
c(box_args, list(colour = "black", alpha = 0.2))
)
do.call(geom_boxplot, box_args)
}

# Adding median, if requested.
Expand Down

0 comments on commit 4502db7

Please sign in to comment.