vertical lines as separator between categorical groups in nested axis
johanneswerner opened this issue · comments
First example from: https://teunbrand.github.io/ggh4x/reference/guide_axis_nested.html
# The defaults are suited for interaction variables
ggplot(mpg, aes(interaction(cyl, class), hwy)) +
geom_boxplot() +
scale_x_discrete(guide = "axis_nested")
Is it possible for clearer separation to add vertical lines between each group of the x axis?
Second, unrelated question: How can I show all cylinders for each car class? (i.e. can I show the values 4, 5, 6 and 8 for each car class without adding dummy data to the data frame)
Thank you!
Hi there,
Is it possible for clearer separation to add vertical lines between each group of the x axis?
No, only horizontal indicators are possible. I don't plan on honouring any feature requests for guides at the moment, because I'm developing a separate package for this.
Second, unrelated question: How can I show all cylinders for each car class? (i.e. can I show the values 4, 5, 6 and 8 for each car class without adding dummy data to the data frame)
You can use drop = FALSE
in the scale if you use interaction()
in the aesthetic. Otherwise, you might have to set the scale's limits/breaks manually.
Thanks for letting me know and an answer for my second question. If you don't mind, what is the package name? Or is it not public (yet)?
You can find the package here, but it certainly won't work without the development version of ggplot2.