plot_temporal_trend.Rd
a customizable plotting function that takes in several arguments to plot
a temporal trend of a variable over time using ggplo2
package.
The function allows the user to customize the x and y variables, the display
of error bars, the grouping of the data, the colour and size of the lines,
and many other graphical features. The function returns a plot object that
can be further customized or saved.
This function is currently
plot_temporal_trend(
data_source,
x_var = "age",
x_var_name = "Time (ka BP)",
y_var = "var",
y_var_name = "Estimate",
sel_type = c("single", "group"),
group_var = NULL,
display_error = FALSE,
y_limits = NULL,
sel_y_trans = "identity",
sel_x_trans = "reverse",
x_ticks = seq(0, 12000, 4000),
y_ticks = seq(0, 1, 0.5),
n_y_ticks = 3,
show_rmse = TRUE,
show_bin_summary = TRUE,
summary_bin_size = 1000,
deafult_color_line = "black",
default_color_rmse_highlight = "red",
default_color_summary_line = "blue",
default_color_summary_fill = "lightblue",
group_color_pallete = NULL,
line_size = 1,
line_alpha = 1,
error_alpha = 0.2,
summary_line_size = 0.5,
summary_alpha = 0.5,
default_text_size = 16
)
data.frame to be plotted.
Character. The name of the column in data_source
containing
the x-variable (default: "age")
Character. The name of the x-axis variable (default: "Time (ka BP)")
Character. The name of the column in data_source
containing
the y-variable
Character. The name of the y-axis variable
Character. The type of time series.
"single"
- only one series
"group"
- several series
The function will plot a single line with error bars (if display_error
is
TRUE
). If "group"
, the function will plot multiple lines with different
colours based on the `group_var``
Character. Name of the variable defining the groups
in sel_type
.
Logical. Should an error bar be displayed?
The limits of the y-axis in the form of a vector of length 2
(default: NULL
). If NULL
, the function will calculate the limits
automatically.
Character. Name of a transformation used in scale_y_continuous
(default: "identity"
)
Character. Name of a transformation used in scale_x_continuous
(default: "reverse"
)
Numeric vector with x-ticks.
Numeric vector with y-ticks or "auto"
to set them automatically
If y_ticks
= "auto"
, then set number of automatic ticks
Locigal. Should root mean square error (RMSE) visualisation
be plotted.
Only works for group_var
= "group"
Locigal. Should an age bin summary be plotted?
Only works for group_var
= "group"
.
Size of time bins to use.
Only works for show_bin_summary
= TRUE
.
Character with HEX code.
Character with HEX code.
Character with HEX code.
Character with HEX code.
Optional. Name vector with colours for levels of group_var
Numeric.
Numeric.
Numeric.
Numeric.
Numeric.
Numeric.