Example of parliament diagram using geom_parliament():
library(ggplot2)
library(ggpol)
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()
Hybrid boxplot-scatterplot using geom_boxjitter():
library(ggplot2)
library(ggpol)
df <- data.frame(score = rgamma(150, 4, 1),
gender = sample(c("M", "F"), 150, replace = TRUE),
genotype = factor(sample(1:3, 150, replace = TRUE)))
ggplot(df) + geom_boxjitter(aes(x = genotype, y = score, fill = gender),
jitter.shape = 21, jitter.color = NA,
jitter.height = 0, jitter.width = 0.04,
outlier.color = NA, errorbar.draw = TRUE) +
scale_fill_manual(values = c("#ecb21e", "#812e91")) +
theme_minimal()
Other examples in the vignette:
- geom_arcbar(): arc bar diagrams that span 180 degrees.
- geom_bartext(): unstacking overlapping text-labels in barcharts.
- geom_parliament(): plot parliament diagrams.
- geom_circle(): plot circle-polygons with a specified radius.
- geom_tshighlight(): highlight rectangle in timeseries (wrapper for geom_rect with ymin and ymax).
- geom_boxjitter(): plot a hybrid half boxplot/half scatterplot, with optional errorbars.
- facet_share(): two panels face-to-face with with basic shared axes.