vignettes/b_label-parties_2.Rmd
b_label-parties_2.Rmd
ggparliament
includes two functions for labelling
parliament plots. The first, draw_partylabels()
, plots the
abbreviated name of parties and the number of seats allocated to the
party. The second function, draw_totalseats()
, plots the
total number of parliamentarians in the center of the graph.
data <- election_data %>%
filter(year == "2016" &
country == "USA" &
house == "Representatives")
usa_data <- parliament_data(election_data = data,
type = "semicircle",
party_seats = data$seats,
parl_rows = 8)
ggplot(usa_data, aes(x, y, color=party_long)) +
geom_parliament_seats() +
labs(colour = NULL) +
draw_partylabels(type = "semicircle", party_names = party_short,
party_seats = seats, party_colours = colour) +
scale_colour_manual(values = usa_data$colour,
limits = usa_data$party_long) +
theme_ggparliament(legend = FALSE)
australia <- election_data %>%
filter(country == "Australia" &
house == "Representatives" &
year == 2016)
australia_horseshoe <- parliament_data(election_data = australia,
party_seats = australia$seats,
parl_rows = 4,
type = "horseshoe")
au <- ggplot(australia_horseshoe, aes(x, y, colour = party_short)) +
geom_parliament_seats() +
theme_ggparliament(legend = FALSE) +
labs(colour = NULL,
title = "Australian Parliament") +
draw_partylabels(type = "horseshoe", party_names = party_short,
party_seats = seats, party_colours = colour) +
scale_colour_manual(values = australia$colour,
limits = australia$party_short)
au
data <- election_data %>%
filter(year == "2016" &
country == "USA" &
house == "Representatives")
usa_data <- parliament_data(election_data = data,
type = "semicircle",
party_seats = data$seats,
parl_rows = 8)
ggplot(usa_data, aes(x, y, color=party_long)) +
geom_parliament_seats() +
labs(colour = NULL) +
draw_totalseats(n = 435,
type = "semicircle") +
scale_colour_manual(values = usa_data$colour,
limits = usa_data$party_long) +
theme_ggparliament(legend = FALSE)