View source: R/plot_two_timeseries.R
plot_two_timeseries | R Documentation |
Two condition time series and correlation
plot_two_timeseries(
x_1,
x_2,
region,
series_name_1 = "Historical",
var_y_name_1 = "mean_wt_resid",
var_x_name_1 = "year",
series_name_2 = "VAST",
var_y_name_2 = "mean_wt_resid",
var_x_name_2 = "year",
var_group_name = "common_name",
y_title = "Condition (Z-score)",
fill_title = "Method",
scale_y = TRUE,
year_break = NULL,
x_offset = 0.25,
fill_colors = c("#001743", "#0085CA"),
shapes = c(24, 21),
format_for = "rmd"
)
x_1 |
A data.frame for the first time series. |
x_2 |
A data.frame for the second time series. |
region |
Region. AI, BS, or GOA. Character (1L). |
var_y_name_1 |
Name of the y variable in the data.frame. Character (1L). |
var_x_name_1 |
Name of the x (time variable). Character (1L). |
var_y_name_2 |
Name of the y variable in the data.frame. Character (1L). |
var_x_name_2 |
Name of the x (time variable). Character (1L). |
y_title |
Y-axis title. Character (1L). |
fill_title |
Name of the fill variable to use for plotting. Character (1L). |
scale_y |
Logical. Should y variables be Z-score transformed? |
year_break |
Optional. Year to split a times series for geom_line(); denotes a break in the time series (i.e., EBS and NBS in 2020) |
x_offset |
Offset value to add to an x variable (e.g. year) from one of the time series to improve interpretability. Numeric (1L). |
fill_colors |
Fill colors to use for points. Character (2L). |
shapes |
Shapes to use for points. |
format_for |
"rmd" or "png" |
fill_color |
Fill colors to use for points. |
A ggplot object of the time series
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.