Description Usage Arguments Value Author(s) References Examples
Break factor level labels onto new lines within plots.
1 | label_breaks(dataframe, split.col)
|
dataframe |
A dataframe object. |
split.col |
The column to break its labels onto separate lines. |
Returns a data.frame with the factor element spaces replaces with \n
.
Mollie Taylor and Tyler Rinker <tyler.rinker@gmail.com>
http://www.mollietaylor.com/2013/10/line-breaks-between-words-in-axis.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(1000)
dat <- data.frame(Location = rnorm(1:1000, mean = 200, sd = 75),
Type = sample(c("Big Red Monster", "Little Green Alien",
"One-Eyed, One-Horned Flying Purple People Eater"), 1000, TRUE))
ggplot(dat, aes(x = Type, y = Location)) +
geom_boxplot()
ggplot(label_breaks(dat, 2), aes(x = Type, y = Location)) +
geom_boxplot()
ggplot(label_breaks(dat, "Type"), aes(x = Type, y = Location)) +
geom_boxplot() +
coord_flip()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.