teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
533 stars 32 forks source link

Semi-discrete position scales #94

Closed teunbrand closed 1 year ago

teunbrand commented 1 year ago

Basically a discrete position scale, but you can control whereto a level is mapped, so that you can separate groups for example. A convenient companion for guide_axis_nested().

Adoption has been suggested here: https://github.com/const-ae/gggroupedscale/issues/1#issuecomment-1439049595

teunbrand commented 1 year ago

You can now do this in the 0.2.4 branch.

# A boxplot with interactions
devtools::load_all("~/packages/ggh4x")
#> ℹ Loading ggh4x
#> Loading required package: ggplot2

ggplot(mpg, aes(interaction(year, cyl), displ)) +
  geom_boxplot() +
  scale_x_manual(values = c(1, 2, 4, 6, 7, 9, 10))

Created on 2023-03-28 with reprex v2.0.2