plot.apsim: Visualize the Results of an APSIM Simulation

Description Usage Arguments Details Examples

Description

Plot routine for "apsim" class objects

Usage

1
2
## S3 method for class 'apsim'
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)

apsimr documentation built on May 2, 2019, 3:03 a.m.