diff --git a/_pkgdown.yml b/_pkgdown.yml
index 56dec6d..2b8cdfb 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -2,6 +2,8 @@ destination: "../../websites/R/ggpattern/"
url: "https://trevorldavis.com/R/ggpattern"
development:
mode: auto
+template:
+ bootstrap: 5
reference:
- title: "ggpattern package"
desc: "High level package description"
diff --git a/man/ggpattern.Rd b/man/ggpattern.Rd
index 44865ee..5c4c4f3 100644
--- a/man/ggpattern.Rd
+++ b/man/ggpattern.Rd
@@ -37,7 +37,7 @@ support any/all these features. See \url{https://www.stat.auckland.ac.nz/~paul/
Useful links:
\itemize{
\item \url{https://github.com/trevorld/ggpattern}
- \item \url{https://trevorldavis.com/R/ggpattern/dev/}
+ \item \url{https://trevorldavis.com/R/ggpattern/}
\item Report bugs at \url{https://github.com/trevorld/ggpattern/issues}
}
diff --git a/vignettes/create-logo.Rmd b/vignettes/create-logo.Rmd
index cb37f2f..f1d82f6 100644
--- a/vignettes/create-logo.Rmd
+++ b/vignettes/create-logo.Rmd
@@ -26,7 +26,7 @@ suppressPackageStartupMessages({
Creating the hex logo for `ggpattern`
------------------------------------------------------------------------------
-```{r logo}
+```{r logo, fig.alt="The ggpattern logo: a ggplot2 plot of a striped hexagon."}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Data frame for a polygon
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/vignettes/developing-patterns.Rmd b/vignettes/developing-patterns.Rmd
index a4d30ae..2348a96 100644
--- a/vignettes/developing-patterns.Rmd
+++ b/vignettes/developing-patterns.Rmd
@@ -228,7 +228,7 @@ the geom - in this case we will be using `pattern = 'complex'`.
options(ggpattern_geometry_funcs = list(tiling3 = tiling3_pattern))
```
-```{r}
+```{r tiling3_pattern, fig.alt = "ggplot2 plot using a custom polygon tiling pattern fill."}
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(aes(fill = trt, pattern_type = trt),
diff --git a/vignettes/geom-gallery-array.Rmd b/vignettes/geom-gallery-array.Rmd
index f22fbb3..2a25bc3 100644
--- a/vignettes/geom-gallery-array.Rmd
+++ b/vignettes/geom-gallery-array.Rmd
@@ -9,7 +9,7 @@ vignette: >
-```r
+``` r
suppressPackageStartupMessages({
library("ggplot2")
library("ggpattern")
@@ -23,7 +23,7 @@ suppressPackageStartupMessages({
## `geom_bar_pattern()`
-```r
+``` r
if (require("magick")) {
p <- ggplot(mpg, aes(class)) +
geom_bar_pattern(
@@ -46,12 +46,12 @@ p
}
```
-![](images/gallery-array-bar-1.png)
+
## `geom_bar_pattern()` - fit image to width and tile.
-```r
+``` r
if (require("magick")) {
flags <- c(
@@ -91,12 +91,12 @@ p
}
```
-![](images/gallery-array-bar2-1.png)
+
## `geom_bar_pattern()` + `coord_flip` and fit image to height and graivty towards the east.
-```r
+``` r
if (require("magick")) {
p <- ggplot(mpg, aes(class)) +
@@ -127,14 +127,14 @@ p
}
```
-![](images/gallery-array-bar3-1.png)
+
## pie graph with `geom_bar_pattern()`
* See `gridpattern::names_magick` for a list of all image based patterns from `imagemagick`
-```r
+``` r
if (require("magick")) {
df <- data.frame(
@@ -170,12 +170,12 @@ p
}
```
-![](images/gallery-array-pie-1.png)
+
## `geom_bin2d_pattern()`
-```r
+``` r
if (require("magick")) {
p <- ggplot(diamonds, aes(x, y)) +
@@ -205,11 +205,11 @@ p
#> (`stat_bin2d()`).
```
-![](images/gallery-array-bin2d-1.png)
+
## `geom_boxplot_pattern()`
-```r
+``` r
if (require("magick")) {
standard_image_filenames <- c(
@@ -244,12 +244,12 @@ p
}
```
-![](images/gallery-array-boxplot-1.png)
+
## `geom_col_pattern()`
-```r
+``` r
if (require("magick")) {
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
@@ -271,12 +271,12 @@ p
}
```
-![](images/gallery-array-col-1.png)
+
## `geom_crossbar_pattern()`
-```r
+``` r
if (require("magick")) {
df <- data.frame(
@@ -310,12 +310,12 @@ p
}
```
-![](images/gallery-array-crossbar-1.png)
+
## `geom_density_pattern()`
-```r
+``` r
if (require("magick")) {
seamless_image_filenames <- c(
@@ -347,12 +347,12 @@ p
}
```
-![](images/gallery-array-density-1.png)
+
## `geom_map_pattern()`
-```r
+``` r
if (require("magick") && require("maps")) {
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
@@ -387,12 +387,12 @@ p
}
```
-![](images/gallery-array-map-1.png)
+
## `geom_polygon_pattern()`
-```r
+``` r
if (require("magick")) {
angle <- seq(0, 2*pi, length.out = 7) + pi/6
@@ -420,12 +420,12 @@ p
}
```
-![](images/gallery-array-polygon-1.png)
+
## `geom_rect_pattern()`
-```r
+``` r
if (require("magick")) {
plot_df <- data.frame(
@@ -465,12 +465,12 @@ p
}
```
-![](images/gallery-array-rect-1.png)
+
## `geom_ribbon_pattern()`
-```r
+``` r
if (require("magick")) {
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
@@ -499,12 +499,12 @@ p
}
```
-![](images/gallery-array-ribbon-1.png)
+
## `geom_sf_pattern()`
-```r
+``` r
if (require("dplyr") && require("magick") && require("sf")) {
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
@@ -533,12 +533,12 @@ p
}
```
-![](images/gallery-array-sf-1.png)
+
## `geom_tile_pattern()`
-```r
+``` r
if (require("magick")) {
df <- data.frame(
@@ -578,12 +578,12 @@ p
}
```
-![](images/gallery-array-tile-1.png)
+
## `geom_violin_pattern()`
-```r
+``` r
if (require("magick")) {
p <- ggplot(mtcars, aes(as.factor(cyl), mpg)) +
@@ -608,4 +608,4 @@ p
}
```
-![](images/gallery-array-violin-1.png)
+
diff --git a/vignettes/geom-gallery-array.Rmd.orig b/vignettes/geom-gallery-array.Rmd.orig
index 9d54e48..d08db8b 100644
--- a/vignettes/geom-gallery-array.Rmd.orig
+++ b/vignettes/geom-gallery-array.Rmd.orig
@@ -30,7 +30,7 @@ suppressPackageStartupMessages({
## `geom_bar_pattern()`
-```{r bar, fig.cap=""}
+```{r bar, fig.cap="", fig.alt="Example of 'geom_bar_pattern()'"}
if (require("magick")) {
p <- ggplot(mpg, aes(class)) +
geom_bar_pattern(
@@ -55,7 +55,7 @@ p
## `geom_bar_pattern()` - fit image to width and tile.
-```{r bar2, fig.cap=""}
+```{r bar2, fig.cap="", fig.alt="Example of 'geom_bar_pattern()'"}
if (require("magick")) {
flags <- c(
@@ -97,7 +97,7 @@ p
## `geom_bar_pattern()` + `coord_flip` and fit image to height and graivty towards the east.
-```{r bar3, fig.cap=""}
+```{r bar3, fig.cap="", fig.alt="Example of 'geom_bar_pattern()'"}
if (require("magick")) {
p <- ggplot(mpg, aes(class)) +
@@ -132,7 +132,7 @@ p
* See `gridpattern::names_magick` for a list of all image based patterns from `imagemagick`
-```{r pie, fig.cap=""}
+```{r pie, fig.cap="", fig.alt="Example of 'geom_bar_pattern()'"}
if (require("magick")) {
df <- data.frame(
@@ -170,7 +170,7 @@ p
## `geom_bin2d_pattern()`
-```{r bin2d, fig.cap=""}
+```{r bin2d, fig.cap="", fig.alt="Example of 'geom_bin2d_pattern()'"}
if (require("magick")) {
p <- ggplot(diamonds, aes(x, y)) +
@@ -199,7 +199,7 @@ p
```
## `geom_boxplot_pattern()`
-```{r boxplot, fig.cap=""}
+```{r boxplot, fig.cap="", fig.alt="Example of 'geom_boxplot_pattern()'"}
if (require("magick")) {
standard_image_filenames <- c(
@@ -236,7 +236,7 @@ p
## `geom_col_pattern()`
-```{r col, fig.cap=""}
+```{r col, fig.cap="", fig.alt="Example of 'geom_col_pattern()'"}
if (require("magick")) {
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
@@ -260,7 +260,7 @@ p
## `geom_crossbar_pattern()`
-```{r crossbar, fig.cap=""}
+```{r crossbar, fig.cap="", fig.alt="Example of 'geom_crossbar_pattern()'"}
if (require("magick")) {
df <- data.frame(
@@ -296,7 +296,7 @@ p
## `geom_density_pattern()`
-```{r density, fig.cap=""}
+```{r density, fig.cap="", fig.alt="Example of 'geom_density_pattern()'"}
if (require("magick")) {
seamless_image_filenames <- c(
@@ -330,7 +330,7 @@ p
## `geom_map_pattern()`
-```{r map, fig.width=12, fig.height=9, fig.cap=""}
+```{r map, fig.width=12, fig.height=9, fig.cap="", fig.alt="Example of 'geom_map_pattern()'"}
if (require("magick") && require("maps")) {
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
@@ -367,7 +367,7 @@ p
## `geom_polygon_pattern()`
-```{r polygon, fig.cap=""}
+```{r polygon, fig.cap="", fig.alt="Example of 'geom_polygon_pattern()'"}
if (require("magick")) {
angle <- seq(0, 2*pi, length.out = 7) + pi/6
@@ -397,7 +397,7 @@ p
## `geom_rect_pattern()`
-```{r rect, fig.cap=""}
+```{r rect, fig.cap="", fig.alt="Example of 'geom_rect_pattern()'"}
if (require("magick")) {
plot_df <- data.frame(
@@ -439,7 +439,7 @@ p
## `geom_ribbon_pattern()`
-```{r ribbon, warning=FALSE, fig.cap=""}
+```{r ribbon, warning=FALSE, fig.cap="", fig.alt="Example of 'geom_ribbon_pattern()'"}
if (require("magick")) {
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
@@ -470,7 +470,7 @@ p
## `geom_sf_pattern()`
-```{r sf, fig.cap="", warning=FALSE}
+```{r sf, fig.cap="", warning=FALSE, fig.alt="Example of 'geom_sf_pattern()'"}
if (require("dplyr") && require("magick") && require("sf")) {
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
@@ -501,7 +501,7 @@ p
## `geom_tile_pattern()`
-```{r tile, fig.cap=""}
+```{r tile, fig.cap="", fig.alt="Example of 'geom_tile_pattern()'"}
if (require("magick")) {
df <- data.frame(
@@ -543,7 +543,7 @@ p
## `geom_violin_pattern()`
-```{r violin, fig.cap=""}
+```{r violin, fig.cap="", fig.alt="Example of 'geom_violin_pattern()'"}
if (require("magick")) {
p <- ggplot(mtcars, aes(as.factor(cyl), mpg)) +
diff --git a/vignettes/geom-gallery-geometry.Rmd b/vignettes/geom-gallery-geometry.Rmd
index b873ba7..af28f6b 100644
--- a/vignettes/geom-gallery-geometry.Rmd
+++ b/vignettes/geom-gallery-geometry.Rmd
@@ -10,7 +10,7 @@ vignette: >
-```r
+``` r
suppressPackageStartupMessages({
library("ggplot2")
library("ggpattern")
@@ -23,7 +23,7 @@ suppressPackageStartupMessages({
## B&W Example
-```r
+``` r
df <- data.frame(level = c("a", "b", "c", 'd'), outcome = c(2.3, 1.9, 3.2, 1))
p <- ggplot(df, aes(level, outcome)) +
@@ -47,12 +47,12 @@ p <- ggplot(df, aes(level, outcome)) +
p
```
-![](images/gallery-geometry-bar-bw-1.png)
+
## Colour Example
-```r
+``` r
p <- ggplot(df, aes(level, outcome)) +
geom_col_pattern(
aes(pattern = level, fill = level, pattern_fill = level),
@@ -71,12 +71,12 @@ p <- ggplot(df, aes(level, outcome)) +
p
```
-![](images/gallery-geometry-bar-colour-1.png)
+
## `geom_bar_pattern()`
-```r
+``` r
p <- ggplot(mpg, aes(class)) +
geom_bar_pattern(
aes(
@@ -96,12 +96,12 @@ p <- ggplot(mpg, aes(class)) +
p
```
-![](images/gallery-geometry-bar-1.png)
+
## pie graph with `geom_bar_pattern()`
-```r
+``` r
df <- data.frame(
group = factor(c("Cool", "But", "Use", "Less"), levels = c("Cool", "But", "Use", "Less")),
value = c(10, 20, 30, 40)
@@ -126,12 +126,12 @@ p <- ggplot(df, aes(x="", y = value, pattern = group, pattern_angle = group))+
p
```
-![](images/gallery-geometry-pie-1.png)
+
## `geom_bin2d_pattern()`
-```r
+``` r
p <- ggplot(diamonds, aes(x, y)) +
xlim(4, 10) + ylim(4, 10) +
geom_bin2d_pattern(aes(pattern_spacing = after_stat(density)),
@@ -146,12 +146,12 @@ p
#> (`stat_bin2d()`).
```
-![](images/gallery-geometry-bin2d-1.png)
+
## `geom_boxplot_pattern()`
-```r
+``` r
p <- ggplot(mpg, aes(class, hwy)) +
geom_boxplot_pattern(
aes(
@@ -168,12 +168,12 @@ p <- ggplot(mpg, aes(class, hwy)) +
p
```
-![](images/gallery-geometry-boxplot-1.png)
+
## `geom_col_pattern()`
-```r
+``` r
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
p <- ggplot(df, aes(trt, outcome)) +
@@ -194,12 +194,12 @@ p <- ggplot(df, aes(trt, outcome)) +
p
```
-![](images/gallery-geometry-col-1.png)
+
## `geom_crossbar_pattern()`
-```r
+``` r
df <- data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
@@ -226,12 +226,12 @@ p <- ggplot(df, aes(trt, resp, colour = group)) +
p
```
-![](images/gallery-geometry-crossbar-1.png)
+
## `geom_density_pattern()`
-```r
+``` r
p <- ggplot(mtcars) +
geom_density_pattern(
aes(
@@ -251,12 +251,12 @@ p <- ggplot(mtcars) +
p
```
-![](images/gallery-geometry-density-1.png)
+
## `geom_map_pattern()`
-```r
+``` r
if (require("maps")) {
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
@@ -291,12 +291,12 @@ p
}
```
-![](images/gallery-geometry-map-1.png)
+
## `geom_polygon_pattern()`
-```r
+``` r
angle <- seq(0, 2*pi, length.out = 7) + pi/6
polygon_df <- data.frame(
angle = angle,
@@ -323,12 +323,12 @@ p <- ggplot(polygon_df) +
p
```
-![](images/gallery-geometry-polygon-1.png)
+
## `geom_rect_pattern()`
-```r
+``` r
plot_df <- data.frame(
xmin = c(0, 10),
xmax = c(8, 18),
@@ -364,11 +364,11 @@ p <- ggplot(plot_df) +
p
```
-![](images/gallery-geometry-rect-1.png)
+
## `geom_ribbon_pattern()`
-```r
+``` r
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
p <- ggplot(huron, aes(year)) +
@@ -391,11 +391,11 @@ p <- ggplot(huron, aes(year)) +
p
```
-![](images/gallery-geometry-ribbon-1.png)
+
## `geom_sf_pattern()`
-```r
+``` r
if (require("dplyr") && require("sf")) {
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
@@ -418,12 +418,12 @@ p
}
```
-![](images/gallery-geometry-sf-1.png)
+
## `geom_tile_pattern()`
-```r
+``` r
df <- data.frame(
x = rep(c(2, 5, 7, 9, 12), 2),
y = rep(c(1, 2), each = 5),
@@ -450,12 +450,12 @@ p <- ggplot(df, aes(x, y)) +
p
```
-![](images/gallery-geometry-tile-1.png)
+
## `geom_violin_pattern()`
-```r
+``` r
p <- ggplot(mtcars, aes(as.factor(cyl), mpg)) +
geom_violin_pattern(aes(pattern = as.factor(cyl))) +
theme_bw(18) +
@@ -468,4 +468,4 @@ p <- ggplot(mtcars, aes(as.factor(cyl), mpg)) +
p
```
-![](images/gallery-geometry-violin-1.png)
+
diff --git a/vignettes/geom-gallery-geometry.Rmd.orig b/vignettes/geom-gallery-geometry.Rmd.orig
index 60e58d8..89a4925 100644
--- a/vignettes/geom-gallery-geometry.Rmd.orig
+++ b/vignettes/geom-gallery-geometry.Rmd.orig
@@ -30,7 +30,7 @@ suppressPackageStartupMessages({
## B&W Example
-```{r bar-bw, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r bar-bw, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_col_pattern()'"}
df <- data.frame(level = c("a", "b", "c", 'd'), outcome = c(2.3, 1.9, 3.2, 1))
p <- ggplot(df, aes(level, outcome)) +
@@ -56,7 +56,7 @@ p
## Colour Example
-```{r bar-colour, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r bar-colour, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_col_pattern()'"}
p <- ggplot(df, aes(level, outcome)) +
geom_col_pattern(
aes(pattern = level, fill = level, pattern_fill = level),
@@ -77,7 +77,7 @@ p
## `geom_bar_pattern()`
-```{r bar, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r bar, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_bar_pattern()'"}
p <- ggplot(mpg, aes(class)) +
geom_bar_pattern(
aes(
@@ -99,7 +99,7 @@ p
## pie graph with `geom_bar_pattern()`
-```{r pie, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r pie, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_bar_pattern()'"}
df <- data.frame(
group = factor(c("Cool", "But", "Use", "Less"), levels = c("Cool", "But", "Use", "Less")),
value = c(10, 20, 30, 40)
@@ -126,7 +126,7 @@ p
## `geom_bin2d_pattern()`
-```{r bin2d, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r bin2d, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_bin2d_pattern()'"}
p <- ggplot(diamonds, aes(x, y)) +
xlim(4, 10) + ylim(4, 10) +
geom_bin2d_pattern(aes(pattern_spacing = after_stat(density)),
@@ -141,7 +141,7 @@ p
## `geom_boxplot_pattern()`
-```{r boxplot, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r boxplot, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_boxplot_pattern()'"}
p <- ggplot(mpg, aes(class, hwy)) +
geom_boxplot_pattern(
aes(
@@ -160,7 +160,7 @@ p
## `geom_col_pattern()`
-```{r col, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r col, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_col_pattern()'"}
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
p <- ggplot(df, aes(trt, outcome)) +
@@ -183,7 +183,7 @@ p
## `geom_crossbar_pattern()`
-```{r crossbar, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r crossbar, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_crossbar_pattern()'"}
df <- data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
@@ -212,7 +212,7 @@ p
## `geom_density_pattern()`
-```{r density, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r density, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_density_pattern()'"}
p <- ggplot(mtcars) +
geom_density_pattern(
aes(
@@ -234,7 +234,7 @@ p
## `geom_map_pattern()`
-```{r map, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r map, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_map_pattern()'"}
if (require("maps")) {
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
@@ -271,7 +271,7 @@ p
## `geom_polygon_pattern()`
-```{r polygon, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r polygon, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_polygon_pattern()'"}
angle <- seq(0, 2*pi, length.out = 7) + pi/6
polygon_df <- data.frame(
angle = angle,
@@ -300,7 +300,7 @@ p
## `geom_rect_pattern()`
-```{r rect, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r rect, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_rect_pattern()'"}
plot_df <- data.frame(
xmin = c(0, 10),
xmax = c(8, 18),
@@ -337,7 +337,7 @@ p
```
## `geom_ribbon_pattern()`
-```{r ribbon, fig.width = 12, fig.height = 9, warning=FALSE, fig.cap=""}
+```{r ribbon, fig.width = 12, fig.height = 9, warning=FALSE, fig.cap="", fig.alt="Example of 'geom_ribbon_pattern()'"}
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
p <- ggplot(huron, aes(year)) +
@@ -361,7 +361,7 @@ p
```
## `geom_sf_pattern()`
-```{r sf, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r sf, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_sf_pattern()'"}
if (require("dplyr") && require("sf")) {
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
@@ -386,7 +386,7 @@ p
## `geom_tile_pattern()`
-```{r tile, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r tile, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_tile_pattern()'"}
df <- data.frame(
x = rep(c(2, 5, 7, 9, 12), 2),
y = rep(c(1, 2), each = 5),
@@ -415,7 +415,7 @@ p
## `geom_violin_pattern()`
-```{r violin, fig.width = 12, fig.height = 9, fig.cap=""}
+```{r violin, fig.width = 12, fig.height = 9, fig.cap="", fig.alt="Example of 'geom_violin_pattern()'"}
p <- ggplot(mtcars, aes(as.factor(cyl), mpg)) +
geom_violin_pattern(aes(pattern = as.factor(cyl))) +
theme_bw(18) +
diff --git a/vignettes/geometry-based-pattern-parameters.Rmd b/vignettes/geometry-based-pattern-parameters.Rmd
index 0435ef0..fe0624b 100644
--- a/vignettes/geometry-based-pattern-parameters.Rmd
+++ b/vignettes/geometry-based-pattern-parameters.Rmd
@@ -35,7 +35,7 @@ Given the same locations for the pattern elements, changing the `pattern_density
changes how far the elements extend towards their neighbours. It is a fraction,
and usually requires values in the range [0, 1]. Not settable in the "polygon_tiling" pattern.
-```{r echo=FALSE}
+```{r pattern_density, echo=FALSE, fig.cap="", fig.alt="Plot of various patterns with different 'pattern_density' values."}
density <- c(0.01, 0.04, 0.1, 0.2, 0.4, 0.7)
rotation <- head(seq(0, 90, length.out = 7), -1)
spacing <- c(0.01, 0.02, 0.04, 0.08, 0.16, 0.32)
@@ -88,7 +88,7 @@ p
`pattern_spacing` determines how far away individual elements are from each
other.
-```{r echo=FALSE}
+```{r pattern_spacing, echo=FALSE, fig.cap="", fig.alt="Plot of various patterns with different 'pattern_spacing' values."}
density <- c(0.01, 0.04, 0.1, 0.2, 0.4, 0.7)
rotation <- head(seq(0, 90, length.out = 7), -1)
spacing <- rev(c(0.01, 0.02, 0.03, 0.04, 0.08, 0.16))
@@ -134,7 +134,7 @@ p
`pattern_angle`
-------------------------------------------------------------------------------
-```{r echo=FALSE}
+```{r pattern_angle, echo=FALSE, fig.cap="", fig.alt="Plot of various patterns with different 'pattern_angle' values."}
density <- c(0.01, 0.04, 0.1, 0.2, 0.4, 0.7)
angle <- head(seq(0, 90, length.out = 7), -1)
spacing <- c(0.01, 0.02, 0.04, 0.08, 0.16, 0.32)
@@ -180,5 +180,3 @@ p <- ggplot(plot_df, aes(x = col, y = row)) +
p
```
-
-
diff --git a/vignettes/gganimate.Rmd b/vignettes/gganimate.Rmd
index ec48f62..aa38761 100644
--- a/vignettes/gganimate.Rmd
+++ b/vignettes/gganimate.Rmd
@@ -23,7 +23,7 @@ Using `gganimate` with `ggpattern`
This is a very simple proof-of-concept of animating a ggpattern with gganimate.
-```{r, eval = requireNamespace("gganimate", quietly = TRUE)}
+```{r animation, eval = requireNamespace("gganimate", quietly = TRUE), fig.cap="", fig.alt="ggplot2 animation transitioning between two states."}
library("ggplot2")
library("ggpattern")
library("gganimate")
@@ -59,3 +59,4 @@ p <- p + transition_states(time, transition_length = 2,
state_length = 0, wrap = FALSE)
animate(p, nframes = 60, fps = 20)
+```
diff --git a/vignettes/patterns-image.Rmd b/vignettes/patterns-image.Rmd
index 9a439a4..af7f458 100644
--- a/vignettes/patterns-image.Rmd
+++ b/vignettes/patterns-image.Rmd
@@ -10,7 +10,7 @@ vignette: >
-```r
+``` r
suppressPackageStartupMessages({
library("ggplot2")
library("ggpattern")
@@ -73,7 +73,7 @@ Note: not all combinations of aesthetics are useful e.g. if `pattern_type = 'fit
These examples use some of the built-in images in the `ggpattern` package.
-```r
+``` r
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# filenames of images
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -118,7 +118,7 @@ Instead a single copy of the image is scaled (`pattern_scale`) and
placed (`pattern_gravity`) in the geom area.
-```r
+``` r
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -144,7 +144,7 @@ ggplot(df1, aes(trt, outcome)) +
}
```
-![](images/patterns-image-none-1.png)
+
### Example: `pattern = 'image'` - Covering the area (`pattern_type = 'fit', 'squish', 'expand'`)
@@ -159,7 +159,7 @@ left-to-right:
to the left side of the geom.
-```r
+``` r
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -186,7 +186,7 @@ ggplot(df1, aes(trt, outcome)) +
}
```
-![](images/patterns-image-covering-1.png)
+
### Example: `pattern = 'image'` - Tiling (`pattern_type = 'tile'`)
@@ -196,7 +196,7 @@ different sizes.
-```r
+``` r
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -223,14 +223,14 @@ ggplot(df1, aes(trt, outcome)) +
}
```
-![](images/patterns-image-tiling-1.png)
+
### Example: `pattern = 'image'` - Tiling with seamless patterns
By choosing a seamlessly tiling image, then a tiled fill will not have visible discontinuities.
-```r
+``` r
if (require("magick")) {
ggplot(mtcars) +
@@ -254,12 +254,12 @@ ggplot(mtcars) +
}
```
-![](images/patterns-image-tiling-seamless-1.png)
+
### Example: `pattern = 'image'` - Tiling with seamless patterns (with scaling)
-```r
+``` r
if (require("magick")) {
ggplot(mtcars) +
@@ -284,7 +284,7 @@ ggplot(mtcars) +
}
```
-![](images/patterns-image-tiling-seamless-scaling-1.png)
+
### Example: `pattern = 'image'` - Tiling with fit to width (of element bounding box)
@@ -296,7 +296,7 @@ Specify `pattern_scale = -1` to fit the width of the geom, and `pattern_scale =
fit the height of the geom.
-```r
+``` r
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -322,7 +322,7 @@ ggplot(df1, aes(trt, outcome)) +
}
```
-![](images/patterns-image-tiling-fit-1.png)
+
## `placeholder` - Filling with an image placeholder
@@ -364,7 +364,7 @@ Click the link to see an example of each placeholder generator
* 'flickr' - [random picture from flickr](https://loremflickr.com/400/300)
* 'keanu' - [Keanu](https://placekeanu.com/400/300)
* 'kitten' - [kitten](https://placekitten.com/400/300)
-* 'murray' - [bill murray](http://fillmurray.lucidinternets.com/400/300)
+* 'murray' - [bill murray](https://fillmurray.lucidinternets.com/400/300)
* 'picsum' - [random picture from picsum](https://picsum.photos/400/300)
* 'placeholder' - [placeholder.com](https://via.placeholder.com/400x300.png)
* 'seagal' - [steven seagal](https://stevensegallery.lucidinternets.com/400/300)
@@ -374,7 +374,7 @@ All placeholder names are available in `gridpattern::names_placeholder`.
### Example Data
-```r
+``` r
df1 <- data.frame(
trt = c("a", "b", "c"),
outcome = c(2.3, 1.9, 3.2),
@@ -385,7 +385,7 @@ df1 <- data.frame(
### Example: `pattern = 'placeholder'` - `pattern_type = 'bear'`
-```r
+``` r
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -406,12 +406,12 @@ ggplot(df1, aes(trt, outcome)) +
}
```
-![](images/patterns-image-bear-1.png)
+
### Example: `pattern = 'placeholder'` - `pattern_type = 'picsum'`
-```r
+``` r
if (require("magick")) {
ggplot(mtcars) +
@@ -431,12 +431,12 @@ ggplot(mtcars) +
}
```
-![](images/patterns-image-picsum-1.png)
+
### Example: `pattern = 'placeholder'` - `pattern_type = 'dummy'`
-```r
+``` r
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -453,11 +453,10 @@ ggplot(df1, aes(trt, outcome)) +
) +
theme(legend.position = 'none') +
coord_fixed(ratio = 1/2)
-
}
```
-![](images/patterns-image-dummy-1.png)
+
## Resetting the image cache
diff --git a/vignettes/patterns-image.Rmd.orig b/vignettes/patterns-image.Rmd.orig
index fc1fc7e..d926066 100644
--- a/vignettes/patterns-image.Rmd.orig
+++ b/vignettes/patterns-image.Rmd.orig
@@ -116,7 +116,7 @@ If `pattern_type = 'none'` then no attempt is made at snugly filling the area.
Instead a single copy of the image is scaled (`pattern_scale`) and
placed (`pattern_gravity`) in the geom area.
-```{r none, fig.cap=""}
+```{r none, fig.cap="", fig.alt="Example of 'image' pattern 'none' type"}
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -154,7 +154,7 @@ left-to-right:
that the entire geom is covered. `pattern_gravity = 'West'` anchors the image
to the left side of the geom.
-```{r covering, fig.cap=""}
+```{r covering, fig.cap="", fig.alt="Example of 'image' pattern with various types"}
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -188,7 +188,7 @@ In this example, `pattern_scale` is also applied to the image so that it appears
different sizes.
-```{r tiling, fig.cap=""}
+```{r tiling, fig.cap="", fig.alt="Example of 'image' pattern 'tile' type"}
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -219,7 +219,7 @@ ggplot(df1, aes(trt, outcome)) +
By choosing a seamlessly tiling image, then a tiled fill will not have visible discontinuities.
-```{r tiling-seamless, fig.cap=""}
+```{r tiling-seamless, fig.cap="", fig.alt="Example of 'image' pattern 'tile' type with seamless patterns."}
if (require("magick")) {
ggplot(mtcars) +
@@ -245,7 +245,7 @@ ggplot(mtcars) +
### Example: `pattern = 'image'` - Tiling with seamless patterns (with scaling)
-```{r tiling-seamless-scaling, fig.cap=""}
+```{r tiling-seamless-scaling, fig.cap="", fig.alt="Example of 'image' pattern 'tile' type with seamless patterns and scaling."}
if (require("magick")) {
ggplot(mtcars) +
@@ -279,7 +279,7 @@ This is useful for bar charts.
Specify `pattern_scale = -1` to fit the width of the geom, and `pattern_scale = -2` to
fit the height of the geom.
-```{r tiling-fit, fig.cap=""}
+```{r tiling-fit, fig.cap="", fig.alt="Example of 'image' pattern 'tile' type with fit to width"}
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -364,7 +364,7 @@ df1 <- data.frame(
### Example: `pattern = 'placeholder'` - `pattern_type = 'bear'`
-```{r bear, fig.cap=""}
+```{r bear, fig.cap="", fig.alt="Example of 'placeholder' pattern 'bear' type"}
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -387,7 +387,7 @@ ggplot(df1, aes(trt, outcome)) +
### Example: `pattern = 'placeholder'` - `pattern_type = 'picsum'`
-```{r picsum, fig.cap=""}
+```{r picsum, fig.cap="", fig.alt="Example of 'placeholder' pattern 'picsum' type"}
if (require("magick")) {
ggplot(mtcars) +
@@ -409,7 +409,7 @@ ggplot(mtcars) +
### Example: `pattern = 'placeholder'` - `pattern_type = 'dummy'`
-```{r dummy, fig.cap=""}
+```{r dummy, fig.cap="", fig.alt="Example of 'placeholder' pattern 'dummy' type"}
if (require("magick")) {
ggplot(df1, aes(trt, outcome)) +
@@ -426,7 +426,6 @@ ggplot(df1, aes(trt, outcome)) +
) +
theme(legend.position = 'none') +
coord_fixed(ratio = 1/2)
-
}
```
diff --git a/vignettes/patterns-noise.Rmd b/vignettes/patterns-noise.Rmd
index 1d7caf6..6795f15 100644
--- a/vignettes/patterns-noise.Rmd
+++ b/vignettes/patterns-noise.Rmd
@@ -67,7 +67,7 @@ df <- data.frame(
## Example: `pattern = 'plasma'` - With `pattern_alpha`
-```{r}
+```{r plasma, fig.cap="", fig.alt="Example of 'plasma' pattern"}
if (require("magick")) {
ggplot(df, aes(trt, outcome)) +
@@ -92,7 +92,7 @@ ggplot(df, aes(trt, outcome)) +
}
```
-```{r}
+```{r plasma2, fig.cap="", fig.alt="Example of 'plasma' pattern with 'pattern_alpha = 0.7'"}
if (require("magick")) {
ggplot(mtcars) +
@@ -117,7 +117,7 @@ ggplot(mtcars) +
Example: `pattern_type = 'gradient'` - Fade to white
------------------------------------------------------------------------------
-```{r}
+```{r gradient, fig.cap="", fig.alt="Example of 'gradient' pattern fade to white"}
if (require("magick")) {
ggplot(df, aes(trt, outcome)) +
@@ -146,7 +146,7 @@ ggplot(df, aes(trt, outcome)) +
Example: `pattern_type = 'gradient'` - Fade to dark blue
------------------------------------------------------------------------------
-```{r}
+```{r gradient2, fig.cap="", fig.alt="Example of 'gradient' pattern fade to dark blue"}
if (require("magick")) {
ggplot(df, aes(trt, outcome)) +
@@ -175,7 +175,7 @@ ggplot(df, aes(trt, outcome)) +
Example: `pattern_type = 'gradient'` - Fade to transparent
------------------------------------------------------------------------------
-```{r}
+```{r gradient3, fig.cap="", fig.alt="Example of 'gradient' pattern fade to transparent"}
if (require("magick")) {
ggplot(df, aes(trt, outcome)) +
@@ -201,7 +201,7 @@ ggplot(df, aes(trt, outcome)) +
## Example: `pattern_type = 'gradient'` - Non-rectangular geom
-```{r}
+```{r gradient4, fig.cap="", fig.alt="Example of 'gradient' pattern with a non-rectangular geom"}
if (require("magick")) {
ggplot(mtcars) +
@@ -227,7 +227,7 @@ ggplot(mtcars) +
## Example: `pattern_type = 'ambient'
-```{r}
+```{r ambient, fig.cap="", fig.alt="Example of 'ambient' pattern"}
if (require("ambient")) {
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
@@ -246,7 +246,7 @@ ggplot(df, aes(trt, outcome)) +
}
```
-```{r}
+```{r ambient2, fig.cap="", fig.alt="Another example of 'ambient' pattern"}
if (require("ambient")) {
ggplot(mtcars) +
geom_density_pattern(
diff --git a/vignettes/patterns-points.Rmd b/vignettes/patterns-points.Rmd
index f6b6951..cfd232d 100644
--- a/vignettes/patterns-points.Rmd
+++ b/vignettes/patterns-points.Rmd
@@ -76,7 +76,7 @@ df
## Vanilla ggplot2
-```{r}
+```{r plain, fig.cap="", fig.alt="Example of a plain ggplot2"}
ggplot(df, aes(trt, outcome)) +
geom_col(aes(fill=trt),colour='black') +
theme_bw() +
@@ -90,7 +90,7 @@ ggplot(df, aes(trt, outcome)) +
* Default legends in `ggplot2` are usually too small to show off an example of
the pattern, so it will usually be necessary to increase the key size.
-```{r}
+```{r ggpattern, fig.cap="", fig.alt="Example using ggpattern to make patterned geoms"}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(aes(fill=trt),colour='black', pattern = 'circle') +
theme_bw() +
@@ -105,7 +105,7 @@ area which should be covered by the pattern.
In the following plot the density of striping is increased to 50% of the fill area.
-```{r}
+```{r density, fig.cap="", fig.alt="Example of increasing density of striping"}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill=trt, pattern_shape=trt),
@@ -120,7 +120,7 @@ ggplot(df, aes(trt, outcome)) +
## The Density Aesthetic as a Mapped Aesthetic
-```{r}
+```{r density2, fig.cap="", fig.alt="Example from using the density aesthetic as a mapped aesthetic"}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_density = trt),
@@ -137,7 +137,7 @@ ggplot(df, aes(trt, outcome)) +
`scale_pattern_density_manual()` can be used to manually control how the variable
is mapped to the density.
-```{r}
+```{r density3, fig.cap="", fig.alt="Example from using the density aesthetic as a mapped aesthetic with manual scale."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_density = trt),
@@ -156,7 +156,7 @@ ggplot(df, aes(trt, outcome)) +
## The Spacing Aesthetic as a Mapped Aesthetic
-```{r}
+```{r spacing, fig.cap="", fig.alt="Example from using the spacing aesthetic as a mapped aesthetic."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_spacing = trt, pattern_shape = trt),
@@ -173,7 +173,7 @@ ggplot(df, aes(trt, outcome)) +
## The Fill Aesthetic as a Mapped Aesthetic ('rose' example)
-```{r}
+```{r fill, fig.cap="", fig.alt="Example from using the fill aesthetic as a mapped aesthetic."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_fill = trt),
diff --git a/vignettes/patterns-stripes.Rmd b/vignettes/patterns-stripes.Rmd
index 9490ce4..631a757 100644
--- a/vignettes/patterns-stripes.Rmd
+++ b/vignettes/patterns-stripes.Rmd
@@ -73,7 +73,7 @@ df
## Vanilla ggplot2
-```{r}
+```{r vanilla, fig.cap="", fig.alt="A plot using vanilla ggplot2"}
ggplot(df, aes(trt, outcome)) +
geom_col(aes(fill=trt),colour='black') +
theme_bw() +
@@ -87,7 +87,7 @@ ggplot(df, aes(trt, outcome)) +
* Default legends in `ggplot2` are usually too small to show off an example of
the pattern, so it will usually be necessary to increase the key size.
-```{r}
+```{r ggpattern, fig.cap="", fig.alt="A plot using ggpattern with a patterned geom"}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(aes(fill=trt),colour='black',
pattern='stripe') +
@@ -105,7 +105,7 @@ ggplot(df, aes(trt, outcome)) +
* The 'wave' pattern supports two subtypes: 'triangle' waves (default) have a zig-zag appearance
whereas 'sine' waves have a curvy appearance.
-```{r}
+```{r mixing, fig.cap="", fig.alt="A plot with both a 'stripe' pattern and a 'wave' pattern."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(aes(fill=trt, pattern=trt, pattern_type=trt),colour='black') +
theme_bw() +
@@ -122,7 +122,7 @@ area which should be covered by the pattern.
In the following plot the density of striping is increased to 50% of the fill area.
-```{r}
+```{r density, fig.cap="", fig.alt="A plot with the density of striping increased to 50% of fill area"}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill=trt, pattern=trt),
@@ -139,7 +139,7 @@ ggplot(df, aes(trt, outcome)) +
The 'weave' pattern supports a rich set of weave types and subtypes including irregular 'matt', 'twill' (including 'herringbone' and 'zigzag' variations), and 'satin' weaves . See the [weave](https://trevorldavis.com/R/gridpattern/dev/reference/pattern_weave.html) pattern documentation for more information.
-```{r}
+```{r weave, fig.cap="", fig.alt="A plot with 'plain', 'twill', 'satin' weave patterns"}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(pattern_fill2=trt, pattern_type=trt),
@@ -157,7 +157,7 @@ ggplot(df, aes(trt, outcome)) +
## The Density Aesthetic as a Mapped Aesthetic
-```{r}
+```{r density2, fig.cap="", fig.alt="Example plot from using the density aesthetic as a mapped aesthetic."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_density = trt),
@@ -177,7 +177,7 @@ ggplot(df, aes(trt, outcome)) +
is mapped to the density.
-```{r}
+```{r density3, fig.cap="", fig.alt="Example plot from using the density aesthetic as a mapped aesthetic with manual scale."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_density = trt),
@@ -193,7 +193,7 @@ ggplot(df, aes(trt, outcome)) +
## The Spacing Aesthetic as a Mapped Aesthetic
-```{r}
+```{r spacing, fig.cap="", fig.alt="Example plot from using the spacing aesthetic as a mapped aesthetic."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_spacing = trt),
@@ -208,7 +208,7 @@ ggplot(df, aes(trt, outcome)) +
## The Fill Aesthetic as a Mapped Aesthetic
-```{r}
+```{r fill, fig.cap="", fig.alt="Example plot from using the fill aesthetic as a mapped aesthetic."}
ggplot(df, aes(trt, outcome)) +
geom_col_pattern(
aes(fill = trt, pattern_fill = trt),
diff --git a/vignettes/patterns-tilings.Rmd b/vignettes/patterns-tilings.Rmd
index 937d3ed..f9e47c9 100644
--- a/vignettes/patterns-tilings.Rmd
+++ b/vignettes/patterns-tilings.Rmd
@@ -60,7 +60,7 @@ Patterns have been scaled (using `pattern_scale`) to make them more visible for
Note that these are all pixel patterns and will always look blocky.
-```{r fig.width=7, fig.height = 12, echo = TRUE}
+```{r magic, fig.width=7, fig.height = 12, echo = TRUE, fig.cap="", fig.alt="A chart of all the various 'magick' pattern type names"}
if (require("magick")) {
df1 <- data.frame(
@@ -91,37 +91,7 @@ ggplot(df1) +
### Example: `pattern = 'magick'` - Transparent patterns
-```{r}
-if (require("magick")) {
-
-df1 <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
-
-ggplot(df1, aes(trt, outcome)) +
- geom_col_pattern(
- aes(
- pattern_type = trt,
- pattern_fill = trt
- ),
- pattern = 'magick',
- pattern_key_scale_factor = 0.7,
- fill = 'white',
- colour = 'black'
- ) +
- theme_bw(15) +
- labs(
- title = "ggpattern::geom_col_pattern()",
- subtitle = "pattern='magick'"
- ) +
- theme(legend.key.size = unit(2, 'cm')) +
- scale_pattern_type_discrete(choices = c('bricks', 'fishscales', 'right45')) +
- coord_fixed(ratio = 1/2)
-
-}
-```
-
-### Example: `pattern = 'magick'` - Transparent patterns (2)
-
-```{r}
+```{r magick2, fig.cap="", fig.alt="A density plot filled with overlapping transparent 'magick' patterns"}
if (require("magick")) {
ggplot(mtcars) +
@@ -148,7 +118,7 @@ ggplot(mtcars) +
### Example: `pattern = 'magick'` - Pie chart
-```{r}
+```{r magick4, fig.cap="", fig.alt="A pie chart with segments filled with various 'magick' pattern types"}
if (require("magick")) {
df2 <- data.frame(
@@ -176,7 +146,6 @@ ggplot(df2, aes(x="", y = value, pattern_angle = group))+
title = "ggpattern::geom_bar_pattern()",
subtitle = "pattern='magick'"
)
-
}
```
@@ -200,7 +169,7 @@ ggplot(df2, aes(x="", y = value, pattern_angle = group))+
### `pattern = 'polygon_tiling'` - `pattern_type` options
-```{r fig.width=7, fig.height = 12, echo = TRUE}
+```{r polygon_tiling, fig.width=7, fig.height = 12, echo = TRUE, fig.cap="", fig.alt="A chart of all the 'polygon_tiling' pattern type names"}
df1 <- data.frame(
x = rep(1:4, 9),
@@ -227,7 +196,7 @@ ggplot(df1) +
### `pattern = 'polygon_tiling'` - Bar chart
-```{r}
+```{r polygon_tiling2, fig.cap = "", fig.alt = "A bar chart filled with the 'polygon_tiling' pattern"}
gg <- ggplot(mtcars) +
geom_density_pattern(
aes(
@@ -248,5 +217,3 @@ gg <- ggplot(mtcars) +
)
plot(gg)
```
-
-