Description Usage Arguments Examples
plot_grid: Flexible function to plot data from get_data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | plot_grid(
df,
minwonderyear = 1999,
maxwonderyear = 2018,
groups = c(sprintf("No Expansion Before %s", maxwonderyear), "Expanded in 2014",
sprintf("Expanded Between 2015 and %s", maxwonderyear)),
group_conditions = c("is.na(aca_date) | year(aca_date) > maxwonderyear",
"year(aca_date) == 2014", "T"),
grid_vars = c("sex", "race"),
ROOTPATH = "",
RUNNAME = "year_state_sex_race_firearms",
save = T,
out_fn = T,
listwise = F,
vline = T,
include_n = F,
width = 6,
height = 4,
xlab = "Year",
ylab = "Crude Rate\n(Per 100k Deaths)",
group_title = "",
colpalette = "Dark2",
include_data = T
)
|
df |
Data frame from get_data |
minwonderyear |
minimum year from Wonder, default 1999 |
maxwonderyear |
maximum year from wonder, default 2018 |
groups |
These are for multiple lines in the same plot. Name the groups here.... |
group_conditions |
... and set their conditions as a string here. |
grid_vars |
These are for multiple plots in a grid |
ROOTPATH |
ROOTPATH that includes input and output folders |
RUNNAME |
Name for the data |
save |
Default True, if False does not save the plot |
out_fn |
Default RUNNAME.png |
listwise |
Default False, if True then delete all groups that don't have the max number of observations |
vline |
If numeric, locaiton of a vertical line |
include_n |
Defualt False, if True then group labels are given Ns |
width |
Width of the plot in inches |
height |
Height of the plot in inches |
xlab |
X axis label, Default Year |
ylab |
Y axis label, default Crude Rate Per 100,000 |
group_title |
Name of groups, default "", |
colpalette |
ggplot2 colortheme |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | plot_grid(
df,
minwonderyear = 1999,
maxwonderyear = 2018,
groups = NULL,
group_conditions = NULL,
grid_vars = c("race"),
ROOTPATH = "C:/Users/tcapu/Desktop/wonderdd",
RUNNAME = "year_state_sex_race_opioids",
listwise = F,
vline = F,
save = T,
width = 6,
height = 4,
group_title="",
colpalette="Dark2"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.