Skip to content

Commit

Permalink
minor edits to thickness article
Browse files Browse the repository at this point in the history
  • Loading branch information
mjskay committed Jan 14, 2024
1 parent 0a9779d commit 0e0001d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
26 changes: 19 additions & 7 deletions docs/articles/thickness.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/articles/thickness_files/figure-html/prior_post-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/thickness_files/figure-html/ridgeline-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 19 additions & 7 deletions vignettes/thickness.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ For example:

```{r intro}
df = data.frame(
h = c(0,1,1,0, 0,2,2,0, 0,4/3,4/3,0, 0,1,1,0, 0,1.25,1.25,0, 0,.5,.5,0),
x = c(0,1,4,5, 4,5,6,7, 6,7,9,10, 11,12,15,16, 1,2,4.2,5.2, 4,5,12,13),
y = rep(c("a", "b", "a", "a", "b", "a"), each = 4),
h = c(0,1,1,0, 0,2,2,0, 0,4/3,4/3,0, 0,1,1,0, 0,1.25,1.25,0, 0,.5,.5,0),
x = c(0,1,4,5, 4,5,6,7, 6,7,9,10, 11,12,15,16, 1,2,4.2,5.2, 4,5,12,13),
y = rep(c("a", "b", "a", "a", "b", "a"), each = 4),
group = rep(c("c", "c", "d", "d", "c", "c"), each = 4),
panel = rep(c("e", "e", "e", "e", "f", "f"), each = 4),
name = rep(c(1,2,"3a","3b",4,5), each = 4)
name = rep(c( 1, 2, "3a","3b", 4, 5 ), each = 4)
)
df_group = df %>%
Expand Down Expand Up @@ -263,15 +263,23 @@ prior_post_plot = df_prior_post %>%
scale_y_continuous(breaks = NULL) +
theme(panel.background = element_rect(color = "gray70", fill = NA))
prior_post_plot
prior_post_plot +
labs(
title = "two different slab geometries",
subtitle = "thickness scales are not shared across geometries by default"
)
```

Notice how the two geometries have different `thickness` scales. If we add `scale_thickness_shared()`
to the plot, they will be given the same scale:

```{r prior_post_shared}
prior_post_plot +
scale_thickness_shared()
scale_thickness_shared() +
labs(
title = "two different slab geometries",
subtitle = "using scale_thickness_shared() to share thickness scale across geometries"
)
```

`scaled_thickness_shared()` works by scaling values and then tagging them with
Expand Down Expand Up @@ -429,7 +437,11 @@ data.frame(
y = letters[1:10]
) %>%
ggplot(aes(xdist = d, y = y)) +
stat_slab(height = 3, color = "gray25")
stat_slab(height = 3, color = "gray25") +
labs(
title = "geom_slab()",
subtitle = "using height > 1 to create ridgeline plots"
)
```

```{r reset_options, include=FALSE}
Expand Down

0 comments on commit 0e0001d

Please sign in to comment.