The `data_plot()`

function usually stores information (such as title, axes
labels, etc.) as attributes, while `add_plot_attributes()`

adds this
information to the plot.

## Examples

```
# \dontrun{
library(rstanarm)
#> Loading required package: Rcpp
#> This is rstanarm version 2.21.3
#> - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!
#> - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.
#> - For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores())
library(bayestestR)
library(see)
library(ggplot2)
model <- suppressWarnings(stan_glm(
Sepal.Length ~ Petal.Width + Species + Sepal.Width,
data = iris,
chains = 2, iter = 200
))
#>
#> SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
#> Chain 1:
#> Chain 1: Gradient evaluation took 2.3e-05 seconds
#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.23 seconds.
#> Chain 1: Adjust your expectations accordingly!
#> Chain 1:
#> Chain 1:
#> Chain 1: WARNING: There aren't enough warmup iterations to fit the
#> Chain 1: three stages of adaptation as currently configured.
#> Chain 1: Reducing each adaptation stage to 15%/75%/10% of
#> Chain 1: the given number of warmup iterations:
#> Chain 1: init_buffer = 15
#> Chain 1: adapt_window = 75
#> Chain 1: term_buffer = 10
#> Chain 1:
#> Chain 1: Iteration: 1 / 200 [ 0%] (Warmup)
#> Chain 1: Iteration: 20 / 200 [ 10%] (Warmup)
#> Chain 1: Iteration: 40 / 200 [ 20%] (Warmup)
#> Chain 1: Iteration: 60 / 200 [ 30%] (Warmup)
#> Chain 1: Iteration: 80 / 200 [ 40%] (Warmup)
#> Chain 1: Iteration: 100 / 200 [ 50%] (Warmup)
#> Chain 1: Iteration: 101 / 200 [ 50%] (Sampling)
#> Chain 1: Iteration: 120 / 200 [ 60%] (Sampling)
#> Chain 1: Iteration: 140 / 200 [ 70%] (Sampling)
#> Chain 1: Iteration: 160 / 200 [ 80%] (Sampling)
#> Chain 1: Iteration: 180 / 200 [ 90%] (Sampling)
#> Chain 1: Iteration: 200 / 200 [100%] (Sampling)
#> Chain 1:
#> Chain 1: Elapsed Time: 0.008377 seconds (Warm-up)
#> Chain 1: 0.011357 seconds (Sampling)
#> Chain 1: 0.019734 seconds (Total)
#> Chain 1:
#>
#> SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
#> Chain 2:
#> Chain 2: Gradient evaluation took 1.4e-05 seconds
#> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.14 seconds.
#> Chain 2: Adjust your expectations accordingly!
#> Chain 2:
#> Chain 2:
#> Chain 2: WARNING: There aren't enough warmup iterations to fit the
#> Chain 2: three stages of adaptation as currently configured.
#> Chain 2: Reducing each adaptation stage to 15%/75%/10% of
#> Chain 2: the given number of warmup iterations:
#> Chain 2: init_buffer = 15
#> Chain 2: adapt_window = 75
#> Chain 2: term_buffer = 10
#> Chain 2:
#> Chain 2: Iteration: 1 / 200 [ 0%] (Warmup)
#> Chain 2: Iteration: 20 / 200 [ 10%] (Warmup)
#> Chain 2: Iteration: 40 / 200 [ 20%] (Warmup)
#> Chain 2: Iteration: 60 / 200 [ 30%] (Warmup)
#> Chain 2: Iteration: 80 / 200 [ 40%] (Warmup)
#> Chain 2: Iteration: 100 / 200 [ 50%] (Warmup)
#> Chain 2: Iteration: 101 / 200 [ 50%] (Sampling)
#> Chain 2: Iteration: 120 / 200 [ 60%] (Sampling)
#> Chain 2: Iteration: 140 / 200 [ 70%] (Sampling)
#> Chain 2: Iteration: 160 / 200 [ 80%] (Sampling)
#> Chain 2: Iteration: 180 / 200 [ 90%] (Sampling)
#> Chain 2: Iteration: 200 / 200 [100%] (Sampling)
#> Chain 2:
#> Chain 2: Elapsed Time: 0.010177 seconds (Warm-up)
#> Chain 2: 0.012053 seconds (Sampling)
#> Chain 2: 0.02223 seconds (Total)
#> Chain 2:
result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95))
data <- data_plot(result, data = model)
p <- ggplot(
data,
aes(x = x, y = y, height = height, group = y, fill = fill)
) +
ggridges::geom_ridgeline_gradient()
p
p + add_plot_attributes(data)
# }
```