r-lib / scales

Tools for ggplot2 scales
https://scales.r-lib.org
Other
391 stars 106 forks source link

Feature request: Could `label_*` functions support labelling every nth break? #436

Open davidhodge931 opened 3 months ago

davidhodge931 commented 3 months ago

This is useful, as it provides another way to get the breaks & labels you want - and it can work well depending on the theme used.

I think it'd be ideal if this could be expressed as an argument every_nth argument in each label_* function.

This would then provide a way for the user to then determine the the frequency of labels (e.g. provide a label every 2nd break), and an offset (to start at not the first break if desired).

This is following on from this discussion here https://github.com/tidyverse/ggplot2/issues/5881

davidhodge931 commented 1 month ago

An example of a situation where this is useful..

A plot of monthly cases, where you want to demonstrate that it is monthly on the x axis using monthly minor breaks.

..But labelling every year does not fit for the size of image that you want to make. It works nice to label every 2nd break in this case

image