Skip to content

Instantly share code, notes, and snippets.

View Brunanza's full-sized avatar

Bruno Grafe Brunanza

View GitHub Profile
@Brunanza
Brunanza / Boxplot_legend.R
Created January 15, 2026 09:25
Boxplot description (as seperate plot to add via e.g. patchwork library)
create_boxplot_legend <- function(){
# Create sample data for a simple boxplot
set.seed(42) # Set seed for reproducibility
df_legend <- data.frame(x = rep("", 50), y = c(rnorm(40, 50, 10), rnorm(10, 80, 5)))
# Calculate quartiles for annotation
q1 <- quantile(df_legend$y, 0.25)
q2 <- quantile(df_legend$y, 0.5) # median
q3 <- quantile(df_legend$y, 0.75)
iqr <- q3 - q1