performance_plot {eiExpand} | R Documentation |
Performance Analysis Plotting Function
Description
Uses output from performance()
to create a ggplot
performance analysis visualization.
Usage
performance_plot(
perfDF,
title = "Performance Analysis Results",
subtitle = NULL,
legend_name = "Preferred Candidate:",
preferred_cand_races = NULL,
colors = NULL,
breaks = seq(0, 100, 20),
lims = c(0, 100),
bar_size = 5,
label_size = 4,
position_dodge_width = 0.8,
cand_name_size = 6,
cand_name_pad = -1,
contest_name_size = 20,
contest_name_pad = NULL,
panel_spacing = 0.7,
panelBy = "Jurisdiction",
includeCandName = TRUE,
includeMeanDiff = TRUE
)
Arguments
perfDF |
A data.frame object containing performance analysis results
from |
title |
The plot title |
subtitle |
The plot subtitle |
legend_name |
The legend title |
preferred_cand_races |
A character vector of the unique races contained
in the |
colors |
Plot colors for the voter race groups. Colors must
be listed in the desired order with respect |
breaks |
Numeric vector containing x axis breaks |
lims |
Numeric vector containing x axis limits |
bar_size |
The size of plot bars. Passed to |
label_size |
The size of vote share labels |
position_dodge_width |
The width value passed to |
cand_name_size |
Text size of candidate names if |
cand_name_pad |
Padding between candidate name and y axis if
|
contest_name_size |
Text size of contest name |
contest_name_pad |
Padding between contest name and y axis |
panel_spacing |
space between panels. This argument is relevant only if
there are multiple jurisdictions in |
panelBy |
Column name from perfDF passed to |
includeCandName |
Logical indicating if candidate names should appear on the left side of the plot. |
includeMeanDiff |
Logical indicating if the mean difference between preferred_candidate across all elections should appear in the plot. |
Value
ggplot visualization of performance analysis
Author(s)
Rachel Carroll <rachelcarroll4@gmail.com>
See Also
Examples
library(eiExpand)
data(example_performance_results)
performance_plot(example_performance_results)
#ggplot2::ggsave("perf_plot.png", width = 12, height = 7)