This function adds a geom_bartext geom which essentially composes geom_bar() and geom_text()
1 2 3 |
1 2 3 4 5 6 7 8 9 10 11 | library(dplyr)
library(ggplot2)
mpg_manu <- mpg %>%
distinct(manufacturer, model)
ggplot(mpg_manu, aes(x = manufacturer)) +
geom_bartext(aes(label = model))
ggplot(mpg_manu, aes(x = manufacturer)) +
geom_bartext(aes(label = model), colour = "red", textcolour = "black", fill = "white")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.