geom_parliament {ggpol} | R Documentation |
Create a Parliament Diagram
Description
Draws a parliament diagram based on parties' member counts, where each point in the arc represents a single member of parliament. Parties are plotted right-to-left.
Usage
geom_parliament(
mapping = NULL,
data = NULL,
stat = "parliament",
position = "identity",
r0 = 1.5,
r1 = 3,
n = 360,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_parliament(
mapping = NULL,
data = NULL,
geom = "parliament",
position = "identity",
r0 = 1.5,
r1 = 3,
n = 360,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
Arguments
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. |
r0 |
Inner radius, defaults to 1.5. |
r1 |
Outer radius, defaults to 3. |
n |
Number of passed to 'StatCircle', defaults to 360. |
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 |
Aesthetics
geom_parliament understands the following aesthetics (required aesthetics are in bold): - **seats** - number of seats of the parties - fill - color - linetype - alpha
Computed variables
- x,y
coordinates of individual MPs
Examples
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_parliament(aes(seats = seats, fill = parties), color = "black") +
scale_fill_manual(values = bt$colors, labels = bt$parties) +
coord_fixed() +
theme_void()