Hello all,

EDIT: I can see I've not done this quite the way it should be done to produce an RLE plot (i.e. logging, and median substraction). I will be editing this.

I am producing EDA plots to check normalisation. I would like to center the y-axis on zero for the boxplots in my plot. I can do it by subtracting the median of medians from all values, but is there a one-line ggplot2 or other base function/method/argument that does it?

Data structure:

```
> dds_normalised_counts
# A tibble: 361,422 × 2
sample count
<dbl> <dbl>
1 1 14.0
2 5 14.2
3 6 14.7
4 8 14.5
5 9 15.1
6 10 15.1
7 17 14.7
8 18 14.7
9 19 14.8
10 20 14.0
# ℹ 361,412 more rows
# ℹ Use `print(n = ...)` to see more rows
```

Code:

```
# get median of medians
median_of_medians <- dds_normalised_counts %>%
group_by(sample) %>%
summarize(median = median(count, na.rm=TRUE)) %>%
pull(median) %>%
median()
# subtract from all values
dds_normalised_counts <- dds_normalised_counts %>%
mutate(centered = count-median_of_medians)
# plot
ggplot(dds_normalised_counts, (aes(x = as.factor(sample), y = centered))) +
geom_boxplot(outliers = FALSE, fill = "powderblue") +
xlab('sample') +
ylab('count') +
labs(title = "VST Normalised Counts") +
theme_bw()+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
strip.background = element_rect()
)
```

Without centering:

With centering:

Thanks in advance,

Kenneth