Skip to contents

plot_damage_function() plots and compares damage functions for a given sheet and typology across hazard parameters (duration, period, velocity, salinity). Fixed hazard parameters (single modality) are displayed in the plot subtitle, while varying parameters are distinguished by color (damage and period), line type (duration), line width (velocity), and point symbol (salinity), each in its own legend column.

Usage

plot_damage_function(
  damage,
  destination = tempdir(),
  output_file = NULL,
  sheet = NULL,
  typology = NULL,
  duration = NULL,
  period = NULL,
  velocity = NULL,
  salinity = "non",
  unit = "€/m²",
  language = c("fr", "en")
)

Arguments

damage

either a "damage_function" object or a named list of "damage_function" objects to be compared.

destination

character, path where the plot will be saved if output_file is provided. Default to tempdir().

output_file

character, name of the output file (.pdf, .png, .jpg, or .svg). Default to NULL, nothing is saved.

sheet

character, name of the sheet in damage to be plotted.

typology

character, column name of the sub-type of asset to be plotted.

duration

character or numeric, flood duration (d_min) to be plotted. Default to NULL (all available durations in sheet are plotted).

period

character or numeric, flood occurrence period (p_min) to be plotted when present in sheet (e.g. for "agriculture"). Default to NULL (all available periods in sheet are plotted).

velocity

numeric or character, flood water velocity (v_min) to be plotted when present in sheet. Default to NULL (all available velocities in sheet are plotted).

salinity

character, water salinity (salinite) to be plotted. Default to "non" (NULL plots all available modalities).

unit

character, unit displayed on the y-axis label. Default to "\u20ac/m\u00b2".

language

character, language used for plot title and axis labels, either "fr" or "en". Default to "fr".

Value

Path of the output file (NULL invisibly if output_file is NULL).

Examples


if (FALSE) { # \dontrun{
# Example with internal dwelling damage functions
dwelling = list(
     initial = read_damage_function("dwelling"),
     final = update_damage_function("dwelling")
)

sheet = "logement_surface"
typology = "collectif_immobilier"
plot_damage_function(dwelling[["initial"]], sheet = sheet, typology = typology)
plot_damage_function(dwelling[["final"]], sheet = sheet, typology = typology)
plot_damage_function(dwelling, sheet = sheet, typology = typology)

# Example with internal activity damage functions
activity = list(
     initial = read_damage_function("activity"),
     final = update_damage_function("activity")
)

sheet = "batiment_surface"
typology = "4332C"
plot_damage_function(activity[["initial"]], sheet = sheet, typology = typology)
plot_damage_function(activity[["final"]], sheet = sheet, typology = typology)
plot_damage_function(activity, sheet = sheet, typology = typology)

sheet = "equipement_stock_employe"
plot_damage_function(activity, sheet = sheet, typology = "4332C", unit = "\u20ac/emp")
plot_damage_function(activity, sheet = "total_employe", typology = "4332C", unit = "\u20ac/emp")

# Example with internal agriculture damage functions
agriculture = read_damage_function("agriculture")
plot_damage_function(
     agriculture,
     sheet = "parcelle_surface",
     typology = "Bl\u00e9 tendre",
     unit = "\u20ac/ha"
)
plot_damage_function(
     agriculture,
     sheet = "parcelle_surface",
     typology = "Bl\u00e9 tendre",
     period = 14,
     velocity = 0.5,
     unit = "\u20ac/ha"
)
} # }