To be used with
coord_capped_cart, etc. for displaying brackets instead
of the axis ticks and lines.
1 2 3 4 5
Which way should the opening side of the brackets point? up, down, left, or right?
Length of the unit, parallel with axis line.
Height (width) of x-axis (y-axis) bracket.
The looks of the brackets are taken from
It does not re-calculate tick marks, but lets
calculate and draw ticks and labels, and then modifies the ticks with brackets.
tick.length accepts a numeric scalar instead of
unit object that is interpreted as an
1 2 3 4 5 6 7 8 9 10 11 12 13 14
library(ggplot2) p <- ggplot(mpg, aes(as.factor(cyl), hwy, colour=class)) + geom_point(position=position_jitter(width=0.3)) + theme_bw() + theme(panel.border = element_blank(), axis.line = element_line()) p p <- p + coord_flex_cart(bottom=brackets_horizontal(length=unit(0.08, 'npc'))) p # However getting the correct width is a matter of tweaking either length or # position_jitter... # A further adjustment, p + theme(panel.grid.major.x = element_blank())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.