Skip to contents

`plot_aggregated_damage()` makes a plot of agricultural damage. It can plot any damage function that has been aggregated with `aggregate_damage()`.

Usage

plot_aggregated_damage(
  path,
  damage = "total.aggregate",
  current = "light",
  duration = c("short", "long"),
  week = NULL,
  col = NULL,
  culture = NULL,
  output_prefix = NULL,
  output_format = c("none", "pdf", "png", "jpg", "svg"),
  language = "EN",
  hazard = floodam.agri::HAZARD,
  verbose = TRUE,
  legend = c("none", "include", "horizontal", "vertical"),
  include_legend = c("topleft", "bottomright", "bottom", "bottomleft", "left", "top",
    "topright", "right")
)

Arguments

path

list describing where to find useful paths.

damage

character, type of damage to be plotted. If NULL, "total.aggregate.csv" is selected. Default to NULL.

current

character, current to be plotted. Default to "light".

duration

character, duration to be plotted. Default to "c("short", "long")".

week

character, periods to be plotted. If NULL, all periods will be plotted. Default to NULL.

col

character, named or unnamed vector of colors for plot lines. Must be at least of the same length as week. If col is unnamed, the attribution of colors to week will be made by default, you must set names of col accordingly to values of week if you want to control the colors for each week. If NULL, default colors will be picked from the library("RColorBrewer"). Default to NULL.

culture

character, name of crops to be plotted. If set to NULL, all crops available in the provided damage function will be plotted. Default to NULL.

output_prefix

character, prefix to give to output file. Default to NULL

output_format

character, choice for the output format if saving is desired. If NULL or "none", plot will not be saved but will be shown. Default to NULL.

language

character, language for plot labels. Must be chosen from one of c("EN", "FR"). Default to "EN".

hazard

character, name of hazard parameters. Default to floodam.agri::HAZARD.

verbose

logical, should the function send some messages while running.

legend

character, choice for the legend format. If NULL or "none", legend will not be created.

include_legend

character, position of legend inside the plot. `legend` must be set to "include" for `include_legend` to be used.

Value

damage curve or damage curves for aggregated damage functions. It can be simply shown or saved in the `output_format` format in the output directory from `path[["output"]][["figure"]]`

Details

By default, `plot_aggregated_damage()` will return a title for the plot which includes the name of the crop that is plotted. This title is given by a data.frame giving the correspondance between the floodam crop name and the crop name to be shown on the plot. To customize the crop names as you desire, a csv file named `title.culture.csv` should be added to your `typology` folder. The first column should be the crop name used for building the damage functions, the second column should be the name to be plotted.