Skip to content

Commit

Permalink
Add geom_lineribbon defaults to weave_geom_defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhodge931 committed Dec 1, 2024
1 parent ecbf5e3 commit 411318c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
3 changes: 3 additions & 0 deletions R/weave.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ weave_geom_defaults <- function(
#text
ggplot2::update_geom_defaults("text", ggplot2::aes(colour = !!text_colour, size = !!text_size, family = !!text_family))
ggplot2::update_geom_defaults("label", ggplot2::aes(colour = !!text_colour, fill = !!text_colour, alpha = 0.05, size = !!text_size, family = !!text_family))

#extras
ggplot2::update_geom_defaults("lineribbon", ggplot2::aes(colour = !!colour, fill = !!fill, linewidth = 0.66))
}

#' Set a discrete colour and fill palettes
Expand Down
1 change: 1 addition & 0 deletions vignettes/articles/2_demo_dark.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ penguins2 |>
gg_density(
x = flipper_length_mm,
col = species,
col_palette = c(teal, orange, pink),
blend = "multiply",
mode = dark_mode_t(),
)
Expand Down
45 changes: 19 additions & 26 deletions vignettes/articles/4_extensions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,27 @@ ggridges::Catalan_elections |>

### ggdist

The ggdist package enables the visualisation of uncertainty.
The ggdist package supports the visualisation of uncertainty.

```{r}
library(ggdist)
geom_lineribbon()
data.frame(year = 1875:1972, level = as.vector(LakeHuron)) |>
mutate(level_min = level - 1, level_max = level + 1) |>
gg_blanket(
geom = "lineribbon",
x = year,
y = level,
ymin = level_min,
ymax = level_max,
x_labels = \(x) x,
y_label = "Level",
blend = "multiply",
)
```

```{r}
library(distributional)
geom_slabinterval()
Expand Down Expand Up @@ -311,29 +328,6 @@ data.frame(
theme(legend.position = "none")
```

```{r}
geom_lineribbon()
set.seed(123)
tibble(x = 1:10) |>
group_by(across(everything())) |>
do(tibble(y = rnorm(100, .$x))) |>
median_qi(.width = c(0.5, 0.8, 0.95)) |>
mutate(.width = factor(.width)) |>
gg_blanket(
geom = "lineribbon",
x = x,
y = y,
ymin = .lower,
ymax = .upper,
col = .width,
colour = viridis::mako(n = 9)[c(1)],
col_legend_rev = TRUE,
col_palette = viridis::mako(n = 9)[c(4,6,9)],
)
```

### ggdensity

The ggdensity package provides visualizations of density estimates.
Expand All @@ -355,8 +349,7 @@ data.frame(
x = x,
y = y,
y_symmetric = FALSE,
) +
guides(colour = FALSE, fill = FALSE)
)
```

```{r}
Expand Down

0 comments on commit 411318c

Please sign in to comment.