Cost vs. overflow-volume scatter with n_overflows-coloured points
Source:R/plot_cost_vs_overflow_volume.R
plot_cost_vs_overflow_volume.RdCompanion to plot_wb_tradeoff_overflows for cost-aware
optimisation. Plots the per-scenario total construction cost (EUR) on
the x-axis against the overflow volume (m3) on the y-axis, with the
points coloured discretely by the number of overflow events (same
0..x / >x palette used by plot_wb_tradeoff_overflows, legend at the top)
and shaped by the storage type: filled square = infiltration box
(Sickerbox), filled triangle = gravel trench (Schotterrigol).
Usage
plot_cost_vs_overflow_volume(
simulation_results_optimisation,
param_grid,
x = 1,
filter_n_gtx = FALSE,
use_jitter = TRUE,
jitter_width = 0.15,
jitter_height = 0.15,
jitter_seed = 1L,
digits = 2L,
digits_params = 4L,
lang = c("de", "en"),
param_labels = NULL,
title = NULL,
lab_x = NULL,
lab_y = NULL,
caption = NULL,
legend_position = "top"
)Arguments
- simulation_results_optimisation
Data frame with the columns
scenario_name,n_overflows,sum_overflows,mulde_area,element.WB_Evapotranspiration_,element.WB_InfiltrationNetto_,element.WB_Oberflaechenablauf_Ueberlauf_,cost_excavation,cost_profiling,cost_filter,cost_storage,cost_total,storage_type. Typically the joined output ofadd_overflow_events_and_waterbalance()andcompute_costs().- param_grid
Data frame with parameter grid. Must contain
scenario_name.- x
Numeric threshold for the overflow-count colour bucket. Values greater than
xare pushed into the red">x"category.- filter_n_gtx
Logical. If
TRUE, scenarios withn_overflows > xare dropped before plotting.- use_jitter, jitter_width, jitter_height, jitter_seed
As in
plot_wb_tradeoff_overflows().- digits
Integer. Rounding for numeric values in the tooltip.
- digits_params
Integer. Rounding for parameter values in the tooltip.
- lang
Character. Plot language:
"de"or"en".- param_labels
Named character vector translating
param_gridcolumns to tooltip labels, orNULLto usedefault_param_labels()forlang.- title, lab_x, lab_y
Optional character overrides for the default language-specific title / axis labels.
- caption
Character or
NULL. Caption below the plot naming the unit-cost rates the EUR values were computed with.NULL(default) usescost_rates_caption()with thedefault_cost_rates(); pass your own string if the costs were computed with different rates, or""to drop the caption. Note thatplotly::ggplotly()drops ggplot captions – re-add it to the interactive version viaplotly_add_caption().- legend_position
Character. Legend position, default
"top".
Details
Overflow volume is computed from sum_overflows (in mm on the swale
surface, as returned by add_overflow_events_and_waterbalance())
multiplied by mulde_area (m2) and converted to m3:
overflow_volume_m3 = sum_overflows * mulde_area / 1000.
The tooltip carries the element water balance
(element.WB_Evapotranspiration_, element.WB_InfiltrationNetto_,
element.WB_Oberflaechenablauf_Ueberlauf_, all as % of the total water
input) and the cost breakdown (cost_excavation, cost_profiling,
cost_filter, cost_storage, cost_total), the derived cost per
percentage point of evapotranspiration (EUR/%), the usable storage
volume of the storage layer (m3; area x height x usable porosity
thetaS - thetaFC, from a storage_volume_m3 column or derived from the
storage_theta* columns) plus the varying parameters from param_grid
(excluding scenario_name), so the user can hover over a scatter point
and see exactly why it landed where it did.
The plot language can be switched via lang = "de" or lang = "en".
Titles / axis labels / legend / tooltip labels follow the choice unless
explicit overrides are supplied.
See also
plot_cost_overflow_boxplot() for the same data / tooltip shown as
a cost-by-overflow-count boxplot and plot_cost_vs_evaporation() for
cost vs. the element evapotranspiration share.