plot.statistics: Plot statistics

View source: R/generic_plotting.R

plot.statisticsR Documentation

Plot statistics

Description

Plot statistics

Usage

## S3 method for class 'statistics'
plot(
  x,
  xvar = c("group", "situation"),
  type = c("bar", "radar"),
  group_bar = c("rows", "stack", "dodge"),
  crit_radar = NULL,
  title = NULL,
  force = TRUE,
  verbose = TRUE,
  ...
)

Arguments

x

The output of summary.cropr_simulation()

xvar

The variable to use in x, either the group or the situation (the other is used for colouring)

type

The type of plot requested, either "bar" (bar plot) or "radar" (radar chart)

group_bar

Way to display the different statistical criteria when type= "bar". See details.

crit_radar

Statistical criterion chosen to be displayed on the radar chart.

title

The plot title

force

Continue if the plot is not possible ? E.g. no observations for scatter plots. If TRUE, return NULL, else return an error.

verbose

Boolean. Print information during execution.

...

Other arguments to pass (for backward compatibility only)

Details

The group_bar argument can be:

  • "rows" (the default): One line of graphs per statistical criterion

  • "stack": Bars of each statistical criterion stacked

  • "dodge": Bars of each statistical criterion side by side

Value

Return a ggplot object with statistics

Examples

# Importing an example with three situations with observation:
workspace <- system.file(file.path("extdata", "stics_example_1"),
  package = "CroPlotR"
)
situations <- SticsRFiles::get_usms_list(
  usm_path =
    file.path(workspace, "usms.xml")
)
sim <- SticsRFiles::get_sim(workspace = workspace, usm = situations)
obs <- SticsRFiles::get_obs(workspace = workspace, usm = situations)

# R2 and nRMSE stats for the simulation:
stats <- summary(sim, obs = obs, stats = c("R2", "nRMSE"))
plot(stats)

# Change the group name:
stats <- summary("stics v9.0" = sim, obs = obs, stats = c("R2", "nRMSE"))
plot(stats)

# R2 and nRMSE stats for two groups of simulations:
summary(sim1 = sim, sim2 = sim, obs = obs, stats = c("R2", "nRMSE"))


SticsRPacks/CroPloteR documentation built on April 1, 2024, 9:25 a.m.