plot_output: Plot STICS outputs

View source: R/plot_output.R

plot_outputR Documentation

Plot STICS outputs

Description

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

Usage

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

## 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. 26, 2023, 7:37 a.m.