ggside-scales-discrete | R Documentation |
The xside and yside variants of scale_x_discrete/scale_y_discrete. scale_xsidey_discrete enables better control on how the y-axis is rendered on the xside panel and scale_ysidex_discrete enables better control on how the x-axis is rendered on the yside panel.
ggside_scale object inheriting from ggplot2::ScaleDiscretePosition
library(ggside)
library(ggplot2)
# adding discrete y-scale to the x-side panel, when main panel mapped to continuous data
ggplot(mpg, aes(displ, hwy, colour = class)) +
geom_point() +
geom_xsideboxplot(aes(y=class), orientation = "y") +
theme(ggside.panel.scale = .3) +
scale_xsidey_discrete(guide = guide_axis(angle = 45))
#If you need to specify the main scale, but need to prevent this from
#affecting the side scale. Simply add the appropriate `scale_*side*_*()` function.
ggplot(mpg, aes(class, displ)) +
geom_boxplot() +
geom_ysideboxplot(aes(x = "all"), orientation = "x") +
scale_x_discrete(guide = guide_axis(angle = 90)) + #rotate the main panel text
scale_ysidex_discrete() #leave side panel as default
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.