Learn R Programming

apsimr (version 1.2)

plot.apsim: Visualize the Results of an APSIM Simulation

Description

Plot routine for "apsim" class objects

Usage

"plot"(x, y = NULL, ask = TRUE, one_plot = FALSE, ...)

Arguments

x
data frame of class "apsim" including the results of an APSIM simulation
y
variable to plot on y-axis; if left empty all variables will be plotted on separate plots
ask
logical; if TRUE, the user is asked before each plot, see par(ask=.)
one_plot
logical; if TRUE all variables are plotted on one faceted plot
...
additional arguments passed to qplot

Details

Similar to the plot for lm objects, plot.apsim will plot each response in the results of an APSIM simulation on its own ggplot2 object. If the one_plot argument is set to TRUE then facet_wrap is used to plot all of the responses on one screen. Alternatively, one response can be plotted by setting y to one variable corresponding to a column in x.

Examples

Run this code
## Not run: 
# apsimExe <-"C:/Program Files (x86)/Apsim75-r3008/Model/Apsim.exe"
# apsimWd <- "~/APSIM"
# toRun <- c("Centro.apsim", "Continuous Wheat.apsim")
# results <- apsim(exe = apsimExe, wd = apsimWd, files = toRun)
# 
# #Look at all of the results as a function of time in seperate plots
# plot(results[[2]])
# 
# #Put all variables on one faceted plot
# plot(results[[2]], one_plot = TRUE) + theme_bw()
# 
# #Plot just yield as a function of time
# plot(results[[2]], y = 'yield') + geom_line(colour = 'red') + theme_bw()
# ## End(Not run)

Run the code above in your browser using DataLab