library(ggplot2)
set.seed(1233)
df <- data.frame(
x = sample(letters[1:2], 10, TRUE),
y = rnorm(10)
)
ggplot(df, aes(x, y, color = x)) +
geom_boxplot(
key_glyph = rectangle_key_glyph(fill = color, padding = margin(3, 3, 3, 3))
)
ggplot(df, aes(x, y, color = x)) +
geom_boxplot(
key_glyph = circle_key_glyph(
fill = color,
color = "black", linetype = 3, size = 0.3,
padding = margin(2, 2, 2, 2)
)
)
Run the code above in your browser using DataLab