View source: R/growth_vs_time_plot.R
growth_vs_time_plot | R Documentation |
This function provides a wrapper to ggplot2 in order to generate
different plots from a growth curve model summary list object generated by
the growth_curve_model_fit
function.
Please refer to the documentation for the 'plot_type' parameter for the
different plot options.
growth_vs_time_plot(
growth_model_summary_list,
plot_type = 2,
growth_metric_name = "growth_metric",
time_name = "time",
cluster_name = "cluster",
plot_title = "Growth vs Time",
x_axis_breaks = ggplot2::waiver(),
x_limits = c(NA, NA),
n_x_axis_breaks = NULL,
y_axis_breaks = ggplot2::waiver(),
y_limits = c(NA, NA),
n_y_axis_breaks = NULL,
x_axis_text_size = 8,
y_axis_text_size = 12,
x_axis_title_size = 14,
y_axis_title_size = 14,
plot_title_size = 20,
geom_point_size = 2,
geom_line_width = 0.5,
pred_plot_annotate_value = "double_time",
annotate_value_text_size = 5
)
growth_model_summary_list |
A list object created by the
|
plot_type |
A numeric value used to specify the plot type to graph. Values include 1, 2, 3, 4 with descriptions of each below (defaults to 2):
|
growth_metric_name |
A character string for specifying the name of the growth metric (y-axis title) to be displayed on the plot. Defaults to "growth_metric". |
time_name |
A character string for specifying the name of the time variable (x-axis title) to be displayed on the plot. Defaults to "time". |
cluster_name |
A character string for specifying the name of the cluster variable (legend title) to be displayed on the plot. Defaults to "cluster". |
plot_title |
A character string for specifying the title to be displayed over the plot. Defaults to "Growth vs Time". |
x_axis_breaks |
A numeric vector specifying manual numeric breaks.
Defaults to ggplot2::waiver(). See |
x_limits |
A numeric vector of length two providing limits for
the x-axis. Use NA to refer to the existing minimum or maximum.
Defaults to c(NA, NA). See |
n_x_axis_breaks |
An integer specifying the number of major breaks
for the x-axis. Defaults to NULL.
See |
y_axis_breaks |
A numeric vector specifying manual numeric breaks.
Defaults to ggplot2::waiver(). See |
y_limits |
A numeric vector of length two providing limits for
the y-axis. Use NA to refer to the existing minimum or maximum.
Defaults to c(NA, NA). See |
n_y_axis_breaks |
An integer specifying the number of major breaks
for the x-axis. Defaults to NULL.
See |
x_axis_text_size |
A numeric value specifying the size of the
x-axis text. Defaults to 8. See |
y_axis_text_size |
A numeric value specifying the size of the
y-axis text. Defaults to 12. See |
x_axis_title_size |
A numeric value specifying the size of the
x-axis title. Defaults to 14. See |
y_axis_title_size |
A numeric value specifying the size of the
y-axis title. Defaults to 14. See |
plot_title_size |
A numeric value specifying the size of the plot
title. Defaults to 20. See |
geom_point_size |
A numeric value specifying the size of the points
on the graph. Defaults to 2. See |
geom_line_width |
A numeric value specifying the width of the line (applicable only for plot_type = 2, 3, or 4). Defaults to 0.5. |
pred_plot_annotate_value |
A character string specifying whether to add the doubling time or rate estimates from the model to plot 4. Options include "double_time" for the doubling time with 95% CI, "rate" for the rate estimate with 95% CI, or "none" for no annotation. Defaults to "double_time" |
annotate_value_text_size |
A numeric value specifying the size of
the annotation text. Defaults to 5. See |
Returns a ggplot2 plot
growth_curve_model_fit
# Load example data (exponential data)
data(exp_mixed_data)
# Fit an mixed-effects growth model to the data
exp_mixed_model_summary <- growth_curve_model_fit(
data_frame = exp_mixed_data,
function_type = "exponential",
verbose = FALSE
)
# Create growth vs time plot of data with fitted values (plot_type = 2)
exp_growth_plot <- growth_vs_time_plot(
growth_model_summary_list = exp_mixed_model_summary,
plot_type = 2
)
print(exp_growth_plot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.