KopfLab / ggstackplot

R package for stacked ggplots
https://ggstackplot.kopflab.org
Other
0 stars 0 forks source link

make sure problematic shared axis settings are caught #23

Closed sebkopf closed 1 year ago

sebkopf commented 1 year ago

See https://github.com/KopfLab/ggstackplot/pull/22 for details

sebkopf commented 1 year ago

In version 0.2.8 this now causes an appropriate error @tacaro :

library(ggstackplot)
mtcars |> 
  ggstackplot(
    x = mpg, y = c(wt, qsec, drat),
    add = list(wt = scale_x_continuous(limits = c(10, 15)))
  )
#> Error in `dplyr::mutate()` at ggstackplot/R/helpers.R:262:2:
#> ℹ In argument: `plot_w_theme = pmap(...)`.
#> Caused by error:
#> ! invalid add-on for 'wt' plot: `scale_x_continuous(limits = c(10, 15))`. Modifications of the shared x-axis are not allowed because it can lead to deceptive visualizations. You can modify the shared axis in the template or switch to `simplify_shared_axis = FALSE`.

Created on 2023-07-27 with reprex v2.0.2