modelerCreates several plots for an object of class modeler.
# S3 method for modeler
plot(
x,
id = NULL,
type = 1,
label_size = 4,
base_size = 14,
linewidth = 0.5,
color = "red",
color_points = "black",
parm = NULL,
n_points = 1000,
title = NULL,
add_points = FALSE,
add_ci = TRUE,
color_ci = "blue",
color_pi = "red",
add_ribbon_ci = FALSE,
add_ribbon_pi = FALSE,
color_ribbon_ci = "blue",
color_ribbon_pi = "red",
...
)A ggplot object representing the specified plot.
An object of class modeler, typically the result of calling modeler().
An optional group ID to filter the data for plotting, useful for avoiding overcrowded plots.
Numeric value (1-6) to specify the type of plot to generate. Default is 1.
type = 1Plot of raw data with fitted curves.
type = 2Plot of coefficients with confidence intervals.
type = 3Plot of fitted curves, colored by group.
type = 4Plot of fitted curves with confidence intervals.
type = 5Plot of first derivative with confidence intervals.
type = 6Plot of second derivative with confidence intervals.
Numeric value for the size of labels. Default is 4.
Numeric value for the base font size in pts. Default is 14.
Numeric value specifying size of line geoms. Default is 0.5.
Character string specifying the color for the fitted line when type = 1. Default is "red".
Character string specifying the color for the raw data points when type = 1. Default is "black".
Character vector specifying the parameters to plot for type = 2. If NULL, all parameters are included.
Numeric value specifying the number of points for interpolation along the x-axis. Default is 2000.
Optional character string to add a title to the plot.
Logical value indicating whether to add raw observations to the plot for type = 3 and 4. Default is FALSE.
Logical value indicating whether to add confidence intervals for type = 4, 5, 6. Default is TRUE.
Character string specifying the color of the confidence interval when type = 4, 5, 6. Default is "blue".
Character string specifying the color of the prediction interval when type = 4. Default is "red".
Logical value indicating whether to add a ribbon for confidence intervals in type = 4, 5, 6. Default is FALSE.
Logical value indicating whether to add a ribbon for prediction intervals in type = 4. Default is FALSE.
Character string specifying the color of the ribbon (ci). Default is "blue".
Character string specifying the color of the ribbon (pi). Default is "red".
Additional graphical parameters for future extensions.
Johan Aparicio [aut]
library(flexFitR)
data(dt_potato)
# Example 1
mod_1 <- dt_potato |>
modeler(
x = DAP,
y = Canopy,
grp = Plot,
fn = "fn_lin_plat",
parameters = c(t1 = 45, t2 = 80, k = 0.9),
subset = c(1:3)
)
print(mod_1)
plot(mod_1, id = 1:2)
plot(mod_1, id = 1:3, type = 2, label_size = 10)
Run the code above in your browser using DataLab