View source: R/parliamant_chart.R
parliament_chart | R Documentation |
Display a Parliament Chart
parliament_chart(
data,
categorical_column,
numerical_column,
seatSize = 6,
padding = 2,
maxRows = NULL,
title = NULL,
titleFontSize = 22,
font = "Verdana, Geneva, Tahoma, sans-serif",
bgcol = "#CAD0D3",
width = NULL,
height = NULL
)
data |
A data frame with a categorical column and a numerical column |
categorical_column |
The categorical column to consider |
numerical_column |
The numerical column to consider |
seatSize |
The size of each seat. Defaults to 6. |
padding |
The padding between seats. Defaults to 2. |
maxRows |
The maximum number of rows. Optional. |
title |
The title of the chart. Optional. |
titleFontSize |
Font size for the title. Defaults to 22. |
font |
Font family for text. Defaults to "Verdana, Geneva, Tahoma, sans-serif". |
bgcol |
Background color of the chart. Defaults to "#CAD0D3". |
width |
Width of the SVG canvas. Optional. |
height |
Height of the SVG canvas. Optional. |
A D3-rendered Parliament chart
political_results_example <- data.frame(
political_party = c("SDP", "CDU", "Linke"),
number_of_seats = c(200, 40, 30)
)
parliament_chart(
data = political_results_example,
categorical_column = "political_party",
numerical_column = "number_of_seats",
title = "German Bundestag (results not real, just an example)",
seatSize = 10,
bgcol = "#fefefe"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.