Description Usage Arguments Examples
Repelling text for GeomBar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
parse |
If |
nudge_x |
Horizontal and vertical adjustment to nudge labels by. Useful for offsetting text from points, particularly on discrete scales. |
nudge_y |
Horizontal and vertical adjustment to nudge labels by. Useful for offsetting text from points, particularly on discrete scales. |
spacing |
Defaults to 0.003. Minimum spacing between labels in NPC units. |
dir |
Defaults to "v", i.e. vertical repel of overlapping groups of labels. Can alternatively be set to "h" for horizontal repel. |
check_overlap |
If |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
1 2 3 4 5 6 7 8 9 | df <- data.frame(L = rep(LETTERS[1:2], each = 4),
l = rep(letters[1:4], 2),
val = c(96.5, 1, 2, 0.5, 48, 0.7, 0.3, 51))
ggplot(df, aes(x = L, y = val, fill = l)) +
geom_bar(stat = "identity") +
geom_bartext(aes(label = paste0(val, "%")), position = position_stack(vjust = 0.5)) +
ggtitle("GeomBartext")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.