scatter_45 | R Documentation |
Standard scatterplot with 45 degree line
scatter_45( tbl, xvar, yvar, lblvar = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, size.point = 0.8, size.text = 2, size.errorstat = 2, percent = TRUE, pct_accuracy = 1, ubvar = NULL, lbvar = NULL, colvar = NULL, alpha.CI = 0.75, alpha.point = 0.8, alpha.text = 0.5, alpha.segment = 0.5, max.overlaps = 20, repeat.axis.text = FALSE, by_form = NULL, by_nrow = NULL, by_labels = NULL, show_error = "rmse", expand_axes = TRUE, ... )
tbl |
dataset of summary statistics. Each row must represent a point. Statistics of each point, like the point estimate, 5% quantile, etc.., must be in columns. |
xvar |
Variable to put on x-axis, unquoted |
yvar |
Variable to put on y-axis, unquoted |
lblvar |
Variable to use as labels for |
xlab, ylab |
x and y-axis labels, respectively |
xlim, ylim |
x and y-axis limits, respectively |
size.point |
Size of points to use in ggplot |
size.text |
Size for the labels |
size.errorstat |
Size for the error statistic |
percent |
Are axis values in percent? Defaults to |
pct_accuracy |
If using percents on axes, what is the accuracy. Defaults to |
ubvar, lbvar |
Variable to use as upper and lower bounds for |
colvar |
Variable to use as colors, unquoted |
alpha.point, alpha.CI, alpha.text |
The transparency value for the
points ( |
alpha.segment |
The transparency value for the segments linking the labels to the points, ranging from 0 to 1. |
max.overlaps |
To be passed on to |
repeat.axis.text |
Whether to reproduce the axis texts for every facets in
|
by_form |
If the dataset is in long form with separate rows for different
model estimates, you can supply a formula to be passed on to |
by_nrow |
If using facets, how many rows should the facet take? Defaults to NULL, which is facet_wrap's default |
by_labels |
A named vector for the facets, where the names are the names
of the unique values of the variable by specified in |
show_error |
Which error(s) to show if any. Currently supports
c( |
expand_axes |
Whether to expand the axes so that the plot is a square, even if there is more whitespace. Overrides xlim and ylim. |
... |
Additional arguments sent to the |
library(dplyr) library(ccesMRPrun) mrp_df <- summ_sims(poststrat_draws(fit_GA, poststrat_tgt = acs_GA)) %>% left_join(elec_GA) scatter_45(mrp_df, clinton_vote, p_mrp_est, lblvar = cd, lbvar = p_mrp_050, ubvar = p_mrp_950, xlab = "Clinton Vote", ylab = "MRP Estimate")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.