I'm aware that this is a long-standing problem: setting unlabelled, customizable minor tick marks in ggplot2. I find this post containing a work-around to offer 2 solutions that are somewhat customizable the best, but won't work for me personally: Quick, sleek and simple way of adding minor ticks in ggplot2?.
To my understanding you just plot all major tick marks and set the labelling of some of these, the ones that are supposed to be minor tickmarks, to NULL or "". Thus, the minor tickmarks won't have a label, but the major tickmarks will. This works, but I would like my minor tickmarks to be smaller than major tickmarks and since you cant distinguish between the two here, it doesn't work.
I don't necessarily mind typing out where the minor ticks should be placed each time, as long as this is easy to do consistently.
Given the following fictional dataset and code, is it possible to make minor y-axis ticks here inbetween the major ticks at intervals to lets say every 0.25 that are smaller than the major ticks?
library(ggplot2)
# Create some sample data
set.seed(123)
data <- data.frame(group = rep(c("A", "B"), each = 50),
value = c(rnorm(50, mean = 10), rnorm(50, mean = 20)))
# Create the plot using ggplot2
p <- ggplot(data, aes(x = group, y = value)) +
geom_boxplot()
# Duplicate the y-axis
p + scale_y_continuous(sec.axis = dup_axis()) + theme_classic()