geom_arcbar | R Documentation |
An arc bar diagram that allows for spacing between the individual arc components and spans 180 degrees.
geom_arcbar( mapping = NULL, data = NULL, stat = "arcbar", position = "identity", n = 360, sep = 0.05, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) stat_arcbar( mapping = NULL, data = NULL, geom = "arcbar", position = "identity", n = 360, sep = 0.05, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )
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. |
n |
The number of |
sep |
Separation between the different shares, as a total proportion of pi. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
geom |
The geometric object to use display the data |
geom_arcbar understands the following aesthetics (required aesthetics are in bold):
- **shares** - **r0** - inner radius - **r1** - outer radius - color - fill - linetype - alpha
bt <- data.frame( parties = factor(c("CDU", "CSU", "AfD", "FDP", "SPD", "Linke", "Gruene", "Fraktionslos"), levels = c("CDU", "CSU", "AfD", "FDP", "SPD", "Linke", "Gruene", "Fraktionslos")), seats = c(200, 46, 92, 80, 153, 69, 67, 2), colors = c("black", "blue", "lightblue", "yellow", "red", "purple", "green", "grey"), stringsAsFactors = FALSE) ggplot(bt) + geom_arcbar(aes(shares = seats, r0 = 5, r1 = 10, fill = parties)) + scale_fill_manual(values = bt$colors) + coord_fixed() + theme_void()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.