Skip to contents

Plot

Usage

plot(x, y, ...)

# S4 method for ProgressModel,ANY
plot(
  x,
  seasons = 2002,
  cumulative = TRUE,
  save = FALSE,
  path = cronus::get_path_hermes(),
  file = "plot.pdf",
  width = 15,
  height = 8
)

# S4 method for ProgressModelList,ANY
plot(x, y, ...)

Arguments

x

an object of class ProgressModel or ProgressModelList.

y

not used.

...

extra arguments

seasons

numeric. The seasons of choice to plot.

cumulative

logical. Should the cumulative percentages be plotted?

save

logical. Should the plot be saved?

path

character. The directory in which the plot will be saved.

file

character. The file name.

width

numeric. The width of the plot in inches.

height

numeric. The height of the plot in inches.

Value

A plot, created with ggplot2 The plot is returned wrapped inside invisible().

Examples

if (FALSE) {
# Create a Region object
library(cronus)
region <- Region(name = "nebraska", type = "us state",
                 div = c(country = "United States", state = "Nebraska"))

# Create a model
object1 <- new("ProgressBM",
               region = region,
               crop = "Corn",
               data = data_progress$Corn,
               formula = "CumPercentage ~ Time + agdd") # ProgressModel

# Create another model
object2 <- new("ProgressCLM",
               region = region,
               crop = "Soybeans",
               data = data_progress$Soybeans,
               formula = "Stage ~ Time + agdd + adayl") # ProgressModel

# Concatenate the models
object <- c(object1, object2) # ProgressModelList

# Fit
object <- fit(object)

# Plot
plot(object, cumulative = TRUE, seasons = 2002)

# Predict
predict(object, data_progress)

# Evaluate
object <- crossval(object, maxsam = 100, seed = 1)
plot_rmspe(object)

# Summarize
summary(object)

# Report
report(object, name = "example_report")
}