ggplot_parliament: Create a Parliament Diagram

Description Usage Arguments Examples

Description

Draws a parliament diagram based on parties' member counts, names and colors, where each point in the arc represents a single member of parliament. Parties are plotted left to right in the order of the input vector, unless 'autosort' is set to 'TRUE', in which case they are sorted from most to least members.

Usage

1
2
3
ggplot_parliament(parties, members, party_colors = NA, border_color = NA,
  text_total = TRUE, autosort = FALSE, rad_inner = 1.5, rad_outer = 3,
  circle_n = 360)

Arguments

parties

A vector of parties that make up the diagram

members

A vector of the parties' member count

party_colors

A vector of colors mapped to each party

border_color

Border color of the individual circles. Defaults to NA

text_total

Boolean indicator for whether to display the total number of members inside the diagram. Defaults to TRUE

autosort

Sort the parties from most to least members. Defaults to FALSE

rad_inner

Limiting inner radius of the diagram. Defaults to 1.5

rad_outer

Limiting outer radius of the diagram. Defaults to 3

circle_n

Number of points used to draw circle polygons for each member. Defaults to 360

Examples

1
2
3
4
5
6
7
# Generate Data
bt <- data.frame(
        parties = c("CDU", "CSU", "SPD", "AfD", "FDP", "Linke", "Gruene", "Fraktionslos"),
        seats   = c(200, 46, 153, 92, 80, 69, 67, 2),
        colors  = c("black", "blue", "red", "lightblue", "yellow","purple", "green", "grey"),
        stringsAsFactors = FALSE)
ggplot_parliament(bt$parties, bt$seats, bt$colors)

erocoar/ggparl documentation built on May 24, 2019, 8:48 p.m.