plot_output: Plot STICS outputs

Description Usage Arguments Details Value Examples

View source: R/plot_output.R

Description

Plot stics outputs, compare between USMs, and compare simulations to observations when available.

Usage

1
2
plot_output(..., Vars = NULL, obs_name = NULL, Title = NULL,
  plot_it = T, group = F)

Arguments

...

Either a file path or the output from eval_output If several objects are detected, make a comparison between them.

Vars

Character vector of variables required for plotting.

obs_name

A vector of observation file name(s). It must have the form c(Dominant,Dominated) for mixed crops. See details.

Title

A title for the plot (optional)

plot_it

Boolean. Do the plot as to be pinted ?

group

Boolean (Optional). Should the group column be used for column faceting. If TRUE, make sure that the group column exists in the input

Details

if Vars is NULL (the default), the function plots all variables from the simulation. The output variables from simulations can be set using set_out_var.If obs_name is not provided, the function tries to guess it using the built-in algorithm from read_obs. See respective documentation for more details.

Value

A ggplot object, and print a plot if plot_it is set to TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
library(sticRs)
# Example 1, uing paths as inputs:
plot_output(Sim1= "dummy_path/simulation_1",Sim2= "dummy_path/simulation_2",
            obs_name = c("Wheat.obs","Pea.obs"),
            Title = "Model comparison for Wheat-Pea in Intercrop")

# Example 2, using do.call :
Simulations_path= list(Sim1= "dummy_path/simulation_1",Sim2= "dummy_path/simulation_2")
# Add arguments passed to plot_output() in the "Simulations_path" list:
Simulations_path$Title= "Model comparison for Wheat-Pea in Intercrop"
do.call(plot_output,Simulations_path)

# Example 3, using simulation outputs:
sim1= read_output("dummy_path/simulation_1")
sim2= read_output("dummy_path/simulation_2")
plot_output(sim1=sim1,sim2=sim2)


## End(Not run)

VEZY/sticRs documentation built on Oct. 1, 2018, 1:06 p.m.