Generate Dummy Points to Enforce Symmetric Facet Axes
Source:R/evaluate_generator_plots.R
generate_symmetric_dummy_points.RdCreates invisible points with x = y at the min/max range per facet to force ggplot to use symmetric x/y limits within each facet when scales are free.
Value
Data frame with columns facet_var, Observed, Simulated
(using x_col and y_col names) containing min/max dummy points.
Details
The output includes two points per facet (min and max). These points can be added
with geom_blank() to enforce consistent axis limits without affecting
the visible data.
Examples
df <- data.frame(
variable = c("precip", "precip", "temp", "temp"),
Observed = c(1, 5, 10, 12),
Simulated = c(0.5, 6, 9, 13)
)
generate_symmetric_dummy_points(df, "variable", "Observed", "Simulated")
#> # A tibble: 4 × 3
#> variable Observed Simulated
#> <chr> <dbl> <dbl>
#> 1 precip 0.5 0.5
#> 2 temp 9 9
#> 3 precip 6 6
#> 4 temp 13 13