From 88e5a3700cee141c5bb59ff0dbaab81b211ddde5 Mon Sep 17 00:00:00 2001 From: "Trevor L. Davis" Date: Fri, 5 Jun 2026 21:18:00 -0700 Subject: [PATCH 1/2] feat: New 'line' pattern * New "line" pattern with corresponding `grid.pattern_line()`. Unlike the "stripe" pattern which fills bands with solid colour, "line" draws stroked lines using the device's native line rendering, enabling all of R's built-in `linetype` values (including `"dotdash"`, `"twodash"`, and custom line types specified as hex strings per `?par`). --- DESCRIPTION | 4 +- NAMESPACE | 1 + NEWS.md | 11 ++- R/grid-pattern.R | 4 ++ R/pattern-both-line.R | 130 ++++++++++++++++++++++++++++++++++++ R/pattern-geometry-stripe.R | 1 + R/utils-params.R | 1 + README.Rmd | 1 + README.md | 1 + man/grid.pattern_line.Rd | 126 ++++++++++++++++++++++++++++++++++ man/grid.pattern_stripe.Rd | 3 +- tests/figs/array/line.png | Bin 0 -> 535 bytes tests/testthat/test_array.R | 3 + 13 files changed, 282 insertions(+), 4 deletions(-) create mode 100644 R/pattern-both-line.R create mode 100644 man/grid.pattern_line.Rd create mode 100644 tests/figs/array/line.png diff --git a/DESCRIPTION b/DESCRIPTION index d2e9e21..b1a7ae3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: gridpattern Type: Package Title: 'grid' Pattern Grobs -Version: 1.3.3-3 +Version: 1.4.0-1 Authors@R: c( person("Trevor L.", "Davis", role=c("aut", "cre"), email="trevor.l.davis@gmail.com", comment = c(ORCID = "0000-0001-6341-4639")), @@ -13,7 +13,6 @@ BugReports: https://github.com/trevorld/gridpattern/issues License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.3 Depends: R (>= 3.4.0) Imports: @@ -39,3 +38,4 @@ Suggests: testthat, vdiffr (>= 1.0.6) VignetteBuilder: knitr, rmarkdown +Config/roxygen2/version: 8.0.0 diff --git a/NAMESPACE b/NAMESPACE index 3ed96d1..595f346 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,6 +20,7 @@ export(grid.pattern_crosshatch) export(grid.pattern_fill) export(grid.pattern_gradient) export(grid.pattern_image) +export(grid.pattern_line) export(grid.pattern_magick) export(grid.pattern_none) export(grid.pattern_pch) diff --git a/NEWS.md b/NEWS.md index 0e6eb82..f234029 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,15 @@ -gridpattern v1.3.3 (development) +gridpattern v1.4.0 (development) ================================ +New Features +------------ + +* New "line" pattern with corresponding `grid.pattern_line()`. + Unlike the "stripe" pattern which fills bands with solid colour, + "line" draws stroked lines using the device's native line rendering, + enabling all of R's built-in `linetype` values + (including `"dotdash"`, `"twodash"`, and custom line types specified as hex strings per `?par`). + Bug fixes and minor improvements -------------------------------- diff --git a/R/grid-pattern.R b/R/grid-pattern.R index 1039486..ae360f6 100644 --- a/R/grid-pattern.R +++ b/R/grid-pattern.R @@ -19,6 +19,8 @@ #' See [grid.pattern_gradient()] for more information.} #' \item{image}{Image array patterns. #' See [grid.pattern_image()] for more information.} +#' \item{line}{Line geometry patterns. +#' See [grid.pattern_line()] for more information.} #' \item{magick}{`imagemagick` array patterns. #' See [grid.pattern_magick()] for more information.} #' \item{none}{Does nothing. @@ -157,6 +159,7 @@ names_pattern <- c( "fill", "gradient", "image", + "line", "magick", "none", "pch", @@ -248,6 +251,7 @@ get_pattern_fn <- function(pattern) { crosshatch = create_pattern_crosshatch_via_sf, fill = create_pattern_fill, gradient = create_pattern_gradient, + line = create_pattern_line, none = create_pattern_none, pch = create_pattern_pch, polygon_tiling = create_pattern_polygon_tiling, diff --git a/R/pattern-both-line.R b/R/pattern-both-line.R new file mode 100644 index 0000000..ee57f65 --- /dev/null +++ b/R/pattern-both-line.R @@ -0,0 +1,130 @@ +#' Line patterned grobs +#' +#' `grid.pattern_line()` draws a line pattern onto the graphic device. +#' Unlike [grid.pattern_stripe()] which fills bands with solid colour, +#' this pattern draws stroked lines using the device's native line rendering, +#' enabling all of R's built-in `linetype` values (including `"dotdash"`, +#' `"twodash"`, and custom line types specified as hex strings per `?par`). +#' +#' @inheritParams grid.pattern_circle +#' @inheritParams alphaMaskGrob +#' @param lineend Line end style, one of `"round"` (default), `"butt"`, or `"square"`. +#' @return A grid grob object invisibly. If `draw` is `TRUE` then also draws to the graphic device as a side effect. +#' @examples +#' x_hex <- 0.5 + 0.5 * cos(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6)) +#' y_hex <- 0.5 + 0.5 * sin(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6)) +#' if (capabilities("png") || guess_has_R4.1_features("masks")) { +#' grid::grid.newpage() +#' grid.pattern_line(x_hex, y_hex, colour = "black", angle = 0, spacing = 0.1) +#' } +#' +#' if (capabilities("png") || guess_has_R4.1_features("masks")) { +#' grid::grid.newpage() +#' grid.pattern_line(x_hex, y_hex, colour = "black", linetype = "dotdash", +#' angle = 45, spacing = 0.1) +#' } +#' +#' # more intricate dashed lines are possible with hex strings +#' if (capabilities("png") || guess_has_R4.1_features("masks")) { +#' grid::grid.newpage() +#' grid.pattern_line(x_hex, y_hex, gp = grid::gpar(col = "darkred", lty = "23632E")) +#' } +#' @seealso [grid.pattern_stripe()] for filled bands, [grid.pattern_crosshatch()] for two sets of lines. +#' @export +grid.pattern_line <- function( + x = c(0, 0, 1, 1), + y = c(1, 0, 0, 1), + id = 1L, + ..., + colour = gp$col %||% "grey20", + angle = 30, + spacing = 0.05, + xoffset = 0, + yoffset = 0, + units = "snpc", + alpha = gp$alpha %||% NA_real_, + lineend = gp$lineend %||% "round", + linetype = gp$lty %||% 1, + linewidth = size %||% gp$lwd %||% 1, + size = NULL, + use_R4.1_masks = getOption( + "ggpattern_use_R4.1_masks", + getOption("ggpattern_use_R4.1_features") + ), + png_device = NULL, + res = getOption("ggpattern_res", 72), + default.units = "npc", + name = NULL, + gp = gpar(), + draw = TRUE, + vp = NULL +) { + if (missing(colour) && hasName(l <- list(...), "color")) { + colour <- l$color + } + grid.pattern( + "line", + x, + y, + id, + colour = colour, + angle = angle, + spacing = spacing, + xoffset = xoffset, + yoffset = yoffset, + units = units, + alpha = alpha, + linetype = linetype, + linewidth = linewidth, + lineend = lineend, + use_R4.1_masks = use_R4.1_masks, + png_device = png_device, + res = res, + default.units = default.units, + name = name, + gp = gp, + draw = draw, + vp = vp + ) +} + +create_pattern_line <- function(params, boundary_df, aspect_ratio, legend = FALSE) { + default.units <- "bigpts" + boundary_df <- convert_polygon_df_units(boundary_df, default.units) + params <- convert_params_units(params, default.units) + vpm <- get_vp_measurements(default.units) + grid_xy <- get_xy_grid(params, vpm) + + col <- update_alpha(params$pattern_colour, params$pattern_alpha) + lwd <- params$pattern_linewidth * .pt + lty <- params$pattern_linetype + lineend <- params$pattern_lineend + gp <- gpar(col = col, lwd = lwd, lty = lty, lineend = lineend) + + x0 <- rep(grid_xy$x_min, length(grid_xy$y)) + x1 <- rep(grid_xy$x_max, length(grid_xy$y)) + xy0 <- rotate_xy(x0, grid_xy$y, params$pattern_angle, vpm$x, vpm$y) + xy1 <- rotate_xy(x1, grid_xy$y, params$pattern_angle, vpm$x, vpm$y) + + maskee <- segmentsGrob( + xy0$x, + xy0$y, + xy1$x, + xy1$y, + default.units = default.units, + gp = gp + ) + masker <- convert_polygon_df_to_polygon_grob( + boundary_df, + default.units = default.units, + gp = gpar(fill = "white", col = NA, lwd = 0) + ) + alphaMaskGrob( + maskee, + masker, + use_R4.1_masks = params$pattern_use_R4.1_masks, + png_device = params$pattern_png_device, + res = params$pattern_res, + name = "line" + ) +} diff --git a/R/pattern-geometry-stripe.R b/R/pattern-geometry-stripe.R index 7664f6a..b5f0760 100644 --- a/R/pattern-geometry-stripe.R +++ b/R/pattern-geometry-stripe.R @@ -15,6 +15,7 @@ #' grid.pattern_stripe(x_hex, y_hex, density = 0.3, #' gp = grid::gpar(col = "blue", fill = "yellow")) #' @seealso `[grid.pattern_crosshatch()]` and `[grid.pattern_weave()]` for overlaying stripes. +#' Use [grid.pattern_line()] for stroked lines that support all native `linetype` values. #' @export grid.pattern_stripe <- function( x = c(0, 0, 1, 1), diff --git a/R/utils-params.R b/R/utils-params.R index 36a1bba..4d00459 100644 --- a/R/utils-params.R +++ b/R/utils-params.R @@ -10,6 +10,7 @@ get_params <- function(..., pattern = "none", prefix = "pattern_", gp = gpar()) l$pattern_alpha <- l$pattern_alpha %||% gp$alpha %||% NA_real_ l$pattern_colour <- l$pattern_colour %||% l$pattern_color %||% gp$col %||% "grey20" l$pattern_fill <- l[["pattern_fill"]] %||% gp$fill %||% "grey80" + l$pattern_lineend <- l$pattern_lineend %||% gp$lineend %||% "round" l$pattern_linetype <- l$pattern_linetype %||% gp$lty %||% 1 l$pattern_linewidth <- l$pattern_linewidth %||% l$pattern_size %||% gp$lwd %||% 1 if (pattern == "text") { diff --git a/README.Rmd b/README.Rmd index 9444ae4..61c8eb7 100644 --- a/README.Rmd +++ b/README.Rmd @@ -35,6 +35,7 @@ as well as original "pch", "polygon_tiling", "regular_polygon", "rose", "text", 1. [fill](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_fill.html): simple fill patterns 1. [gradient](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_gradient.html): gradient array/geometry patterns 1. [image](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_image.html): image array patterns +1. [line](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_line.html): line geometry patterns 1. [magick](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_magick.html): imagemagick array patterns 1. [none](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_none.html): draws nothing 1. [placeholder](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_placeholder.html): placeholder image array patterns diff --git a/README.md b/README.md index 430e634..5653878 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ as well as original "pch", "polygon_tiling", "regular_polygon", "rose", "text", 1. [fill](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_fill.html): simple fill patterns 1. [gradient](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_gradient.html): gradient array/geometry patterns 1. [image](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_image.html): image array patterns +1. [line](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_line.html): line geometry patterns 1. [magick](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_magick.html): imagemagick array patterns 1. [none](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_none.html): draws nothing 1. [placeholder](https://trevorldavis.com/R/gridpattern/dev/reference/grid.pattern_placeholder.html): placeholder image array patterns diff --git a/man/grid.pattern_line.Rd b/man/grid.pattern_line.Rd new file mode 100644 index 0000000..dac39b0 --- /dev/null +++ b/man/grid.pattern_line.Rd @@ -0,0 +1,126 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pattern-both-line.R +\name{grid.pattern_line} +\alias{grid.pattern_line} +\title{Line patterned grobs} +\usage{ +grid.pattern_line( + x = c(0, 0, 1, 1), + y = c(1, 0, 0, 1), + id = 1L, + ..., + colour = gp$col \%||\% "grey20", + angle = 30, + spacing = 0.05, + xoffset = 0, + yoffset = 0, + units = "snpc", + alpha = gp$alpha \%||\% NA_real_, + lineend = gp$lineend \%||\% "round", + linetype = gp$lty \%||\% 1, + linewidth = size \%||\% gp$lwd \%||\% 1, + size = NULL, + use_R4.1_masks = getOption("ggpattern_use_R4.1_masks", + getOption("ggpattern_use_R4.1_features")), + png_device = NULL, + res = getOption("ggpattern_res", 72), + default.units = "npc", + name = NULL, + gp = gpar(), + draw = TRUE, + vp = NULL +) +} +\arguments{ +\item{x}{A numeric vector or unit object specifying x-locations of the pattern boundary.} + +\item{y}{A numeric vector or unit object specifying y-locations of the pattern boundary.} + +\item{id}{A numeric vector used to separate locations in x, y into multiple boundaries. +All locations within the same \code{id} belong to the same boundary.} + +\item{...}{Currently ignored.} + +\item{colour}{Stroke colour(s).} + +\item{angle}{Rotation angle in degrees.} + +\item{spacing}{Spacing between repetitions of pattern (in \code{units} units).} + +\item{xoffset}{Shift pattern along x axis (in \code{units} units).} + +\item{yoffset}{Shift pattern along y axis (in \code{units} units).} + +\item{units}{\code{\link[grid:unit]{grid::unit()}} units for \code{spacing}, \code{xoffset}, and \code{yoffset} parameters.} + +\item{alpha}{Alpha (between 0 and 1) or \code{NA} (default, preserves colors' alpha value).} + +\item{lineend}{Line end style, one of \code{"round"} (default), \code{"butt"}, or \code{"square"}.} + +\item{linetype}{Stroke linetype.} + +\item{linewidth}{Stroke linewidth.} + +\item{size}{For backwards compatibility can be used to set \code{linewidth}.} + +\item{use_R4.1_masks}{If \code{TRUE} use the grid mask feature introduced in R v4.1.0. +If \code{FALSE} do a \code{rasterGrob} approximation. +If \code{NULL} try to guess an appropriate choice. +Note not all graphic devices support the grid mask feature.} + +\item{png_device}{\dQuote{png} graphics device to save intermediate raster data with if \code{use_R4.1_masks} is \code{FALSE}. +If \code{NULL} and suggested package \code{ragg} is available +and versions are high enough we directly capture masked raster via \code{\link[ragg:agg_capture]{ragg::agg_capture()}}. +Otherwise we will use \code{png_device} +(default \code{\link[ragg:agg_png]{ragg::agg_png()}} if available else \code{\link[grDevices:png]{grDevices::png()}}) and \code{\link[png:readPNG]{png::readPNG()}} +to manually compute a masked raster.} + +\item{res}{Resolution of desired \code{rasterGrob} in pixels per inch if \code{use_R4.1_masks} is \code{FALSE}.} + +\item{default.units}{A string indicating the default units to use if \code{x} or \code{y} +are only given as numeric vectors.} + +\item{name}{ A character identifier. } + +\item{gp}{An object of class \code{"gpar"}, typically the output + from a call to the function \code{\link[grid]{gpar}}. This is basically + a list of graphical parameter settings.} + +\item{draw}{A logical value indicating whether graphics output + should be produced.} + +\item{vp}{A Grid viewport object (or NULL).} +} +\value{ +A grid grob object invisibly. If \code{draw} is \code{TRUE} then also draws to the graphic device as a side effect. +} +\description{ +\code{grid.pattern_line()} draws a line pattern onto the graphic device. +Unlike \code{\link[=grid.pattern_stripe]{grid.pattern_stripe()}} which fills bands with solid colour, +this pattern draws stroked lines using the device's native line rendering, +enabling all of R's built-in \code{linetype} values (including \code{"dotdash"}, +\code{"twodash"}, and custom line types specified as hex strings per \code{?par}). +} +\examples{ +x_hex <- 0.5 + 0.5 * cos(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6)) +y_hex <- 0.5 + 0.5 * sin(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6)) +if (capabilities("png") || guess_has_R4.1_features("masks")) { + grid::grid.newpage() + grid.pattern_line(x_hex, y_hex, colour = "black", angle = 0, spacing = 0.1) +} + +if (capabilities("png") || guess_has_R4.1_features("masks")) { + grid::grid.newpage() + grid.pattern_line(x_hex, y_hex, colour = "black", linetype = "dotdash", + angle = 45, spacing = 0.1) +} + +# more intricate dashed lines are possible with hex strings +if (capabilities("png") || guess_has_R4.1_features("masks")) { + grid::grid.newpage() + grid.pattern_line(x_hex, y_hex, gp = grid::gpar(col = "darkred", lty = "23632E")) +} +} +\seealso{ +\code{\link[=grid.pattern_stripe]{grid.pattern_stripe()}} for filled bands, \code{\link[=grid.pattern_crosshatch]{grid.pattern_crosshatch()}} for two sets of lines. +} diff --git a/man/grid.pattern_stripe.Rd b/man/grid.pattern_stripe.Rd index cff8c50..c8259fa 100644 --- a/man/grid.pattern_stripe.Rd +++ b/man/grid.pattern_stripe.Rd @@ -41,7 +41,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} @@ -102,4 +102,5 @@ grid.pattern_stripe(x_hex, y_hex, density = 0.3, } \seealso{ \verb{[grid.pattern_crosshatch()]} and \verb{[grid.pattern_weave()]} for overlaying stripes. +Use \code{\link[=grid.pattern_line]{grid.pattern_line()}} for stroked lines that support all native \code{linetype} values. } diff --git a/tests/figs/array/line.png b/tests/figs/array/line.png new file mode 100644 index 0000000000000000000000000000000000000000..541444acc23005ad193f1abe9159880028eed0ab GIT binary patch literal 535 zcmeAS@N?(olHy`uVBq!ia0vp^A3&Ic8Ax(=OD+IW0X`wFK>FRgcmMzY=ez!EDgy)K zNlzEYkcv5PZy4qscHm)fRR3RJ(y&Fd#7#pW?(CIgFRv+ueE7Qe@z+~bA5I1DuUl(V z^}0V!d52%Y+y_<%OPgM^T<2UT9HYL&@5BDuUa9@}NfSiUBHIWJrO@;Opm_vT$K?_t@_0WlH9iamSVW|v9s*_$<2 z?Z-#uSfGU{(qI>SyOet?^~1NQ(pe9V_m`kM5Ul>T_x8-`2XALz&1{mlzl7|5xN-UV zcbCPo<*yH2&RO@z1Li%rG)Q32-V(55!tgjI{&w~bpl9mOz52G|=@a+)6Kf)hzHR28 z@%pfU{94qYgP6Ve;OXBxl@I4v Date: Fri, 5 Jun 2026 21:18:57 -0700 Subject: [PATCH 2/2] chore: Run `document()` with a new version of {roxygen2} --- _pkgdown.yml | 1 + man/grid.pattern.Rd | 7 ++----- man/grid.pattern_circle.Rd | 2 +- man/grid.pattern_crosshatch.Rd | 2 +- man/grid.pattern_fill.Rd | 2 +- man/grid.pattern_magick.Rd | 9 --------- man/grid.pattern_pch.Rd | 2 +- man/grid.pattern_placeholder.Rd | 5 ----- man/grid.pattern_plasma.Rd | 2 +- man/grid.pattern_polygon_tiling.Rd | 7 +------ man/grid.pattern_regular_polygon.Rd | 2 +- man/grid.pattern_rose.Rd | 2 +- man/grid.pattern_text.Rd | 2 +- man/grid.pattern_wave.Rd | 2 +- man/gridpattern-package.Rd | 3 ++- man/patternFill.Rd | 6 +++--- man/pattern_hex.Rd | 5 ----- man/pattern_square.Rd | 5 ----- man/pattern_weave.Rd | 5 ----- 19 files changed, 18 insertions(+), 53 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 114e895..a9f3936 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -4,6 +4,7 @@ development: mode: auto template: bootstrap: 5 +llm-docs: false reference: - title: "Pattern fills" desc: "Pattern fill function" diff --git a/man/grid.pattern.Rd b/man/grid.pattern.Rd index 10fb403..0656469 100644 --- a/man/grid.pattern.Rd +++ b/man/grid.pattern.Rd @@ -1,14 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/grid-pattern.R -\docType{data} \name{grid.pattern} \alias{grid.pattern} \alias{names_pattern} \alias{patternGrob} \title{Create patterned grobs by pattern name} -\format{ -An object of class \code{character} of length 19. -} \usage{ grid.pattern( pattern = "stripe", @@ -98,6 +94,8 @@ See \code{\link[=grid.pattern_crosshatch]{grid.pattern_crosshatch()}} for more i See \code{\link[=grid.pattern_gradient]{grid.pattern_gradient()}} for more information.} \item{image}{Image array patterns. See \code{\link[=grid.pattern_image]{grid.pattern_image()}} for more information.} +\item{line}{Line geometry patterns. +See \code{\link[=grid.pattern_line]{grid.pattern_line()}} for more information.} \item{magick}{\code{imagemagick} array patterns. See \code{\link[=grid.pattern_magick]{grid.pattern_magick()}} for more information.} \item{none}{Does nothing. @@ -181,4 +179,3 @@ See \code{\link[=grid.pattern_weave]{grid.pattern_weave()}} for more information \url{https://coolbutuseless.github.io/package/ggpattern/index.html} for more details on the \code{ggpattern} package. } -\keyword{datasets} diff --git a/man/grid.pattern_circle.Rd b/man/grid.pattern_circle.Rd index 2a8931f..b497fc8 100644 --- a/man/grid.pattern_circle.Rd +++ b/man/grid.pattern_circle.Rd @@ -43,7 +43,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} diff --git a/man/grid.pattern_crosshatch.Rd b/man/grid.pattern_crosshatch.Rd index 7ab4c25..84592e1 100644 --- a/man/grid.pattern_crosshatch.Rd +++ b/man/grid.pattern_crosshatch.Rd @@ -42,7 +42,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{fill2}{The fill colour for the \dQuote{top} crosshatch lines.} diff --git a/man/grid.pattern_fill.Rd b/man/grid.pattern_fill.Rd index 8e0508f..d23f1a1 100644 --- a/man/grid.pattern_fill.Rd +++ b/man/grid.pattern_fill.Rd @@ -28,7 +28,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{...}{Currently ignored} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{alpha}{Alpha (between 0 and 1) or \code{NA} (default, preserves colors' alpha value).} diff --git a/man/grid.pattern_magick.Rd b/man/grid.pattern_magick.Rd index 3cf8846..258a9ff 100644 --- a/man/grid.pattern_magick.Rd +++ b/man/grid.pattern_magick.Rd @@ -1,19 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/pattern-array-magick.R -\docType{data} \name{grid.pattern_magick} \alias{grid.pattern_magick} \alias{names_magick} \alias{names_magick_intensity} \alias{names_magick_stripe} \title{Magick patterned grobs} -\format{ -An object of class \code{character} of length 54. - -An object of class \code{character} of length 21. - -An object of class \code{character} of length 19. -} \usage{ grid.pattern_magick( x = c(0, 0, 1, 1), @@ -105,4 +97,3 @@ plus subsets for shaded intensity and stripes. \seealso{ The \code{imagemagick} documentation \url{http://www.imagemagick.org/script/formats.php} for more information. } -\keyword{datasets} diff --git a/man/grid.pattern_pch.Rd b/man/grid.pattern_pch.Rd index 80d29da..6264217 100644 --- a/man/grid.pattern_pch.Rd +++ b/man/grid.pattern_pch.Rd @@ -46,7 +46,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} diff --git a/man/grid.pattern_placeholder.Rd b/man/grid.pattern_placeholder.Rd index bf92808..11eb8f0 100644 --- a/man/grid.pattern_placeholder.Rd +++ b/man/grid.pattern_placeholder.Rd @@ -1,13 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/pattern-array-placeholder.R -\docType{data} \name{grid.pattern_placeholder} \alias{grid.pattern_placeholder} \alias{names_placeholder} \title{Placeholder image patterned grobs} -\format{ -An object of class \code{character} of length 22. -} \usage{ grid.pattern_placeholder( x = c(0, 0, 1, 1), @@ -83,4 +79,3 @@ A grid grob object invisibly. If \code{draw} is \code{TRUE} then also draws to \seealso{ \code{\link[=reset_image_cache]{reset_image_cache()}} resets the image cache used by \code{\link[=grid.pattern_image]{grid.pattern_image()}} and \code{grid.pattern_placeholder()}. } -\keyword{datasets} diff --git a/man/grid.pattern_plasma.Rd b/man/grid.pattern_plasma.Rd index bc821e1..e4d97d9 100644 --- a/man/grid.pattern_plasma.Rd +++ b/man/grid.pattern_plasma.Rd @@ -73,5 +73,5 @@ A grid grob object invisibly. If \code{draw} is \code{TRUE} then also draws to } \seealso{ \code{\link[=grid.pattern_ambient]{grid.pattern_ambient()}} provides a noise pattern using the \code{ambient} package. -Pseudorandom seeds for the plasma pattern may be set via \code{\link[magick:config]{magick::magick_set_seed()}}. +Pseudorandom seeds for the plasma pattern may be set via \code{\link[magick:magick_set_seed]{magick::magick_set_seed()}}. } diff --git a/man/grid.pattern_polygon_tiling.Rd b/man/grid.pattern_polygon_tiling.Rd index 28126bd..3225626 100644 --- a/man/grid.pattern_polygon_tiling.Rd +++ b/man/grid.pattern_polygon_tiling.Rd @@ -1,13 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/pattern-geometry-tiling.R -\docType{data} \name{grid.pattern_polygon_tiling} \alias{grid.pattern_polygon_tiling} \alias{names_polygon_tiling} \title{Polygon tiling patterned grobs} -\format{ -An object of class \code{character} of length 36. -} \usage{ grid.pattern_polygon_tiling( x = c(0, 0, 1, 1), @@ -47,7 +43,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} @@ -168,4 +164,3 @@ The tiling vignette \code{vignette("tiling", package = "gridpattern")} for more information about these tilings as well as more examples of polygon tiling using the \code{\link[=grid.pattern_regular_polygon]{grid.pattern_regular_polygon()}} function. } -\keyword{datasets} diff --git a/man/grid.pattern_regular_polygon.Rd b/man/grid.pattern_regular_polygon.Rd index e577bdc..4cfcf36 100644 --- a/man/grid.pattern_regular_polygon.Rd +++ b/man/grid.pattern_regular_polygon.Rd @@ -46,7 +46,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} diff --git a/man/grid.pattern_rose.Rd b/man/grid.pattern_rose.Rd index 7db5af7..967d862 100644 --- a/man/grid.pattern_rose.Rd +++ b/man/grid.pattern_rose.Rd @@ -49,7 +49,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} diff --git a/man/grid.pattern_text.Rd b/man/grid.pattern_text.Rd index 03784a2..85824e5 100644 --- a/man/grid.pattern_text.Rd +++ b/man/grid.pattern_text.Rd @@ -62,7 +62,7 @@ All locations within the same \code{id} belong to the same boundary.} applied to exterior radius to get interior radius.} \item{shape}{A character or expression vector. -See \code{label} argument of \code{\link[grid:grid.text]{grid::textGrob()}} for more details.} +See \code{label} argument of \code{\link[grid:textGrob]{grid::textGrob()}} for more details.} \item{grid}{Adjusts placement and density of certain graphical elements. \code{"square"} (default) is a square grid. diff --git a/man/grid.pattern_wave.Rd b/man/grid.pattern_wave.Rd index f972021..fba8f99 100644 --- a/man/grid.pattern_wave.Rd +++ b/man/grid.pattern_wave.Rd @@ -44,7 +44,7 @@ All locations within the same \code{id} belong to the same boundary.} \item{colour}{Stroke colour(s).} -\item{fill}{Fill colour(s) or \code{\link[grid:patterns]{grid::pattern()}} / gradient object(s).} +\item{fill}{Fill colour(s) or \code{\link[grid:pattern]{grid::pattern()}} / gradient object(s).} \item{angle}{Rotation angle in degrees.} diff --git a/man/gridpattern-package.Rd b/man/gridpattern-package.Rd index 0b50743..a4453c7 100644 --- a/man/gridpattern-package.Rd +++ b/man/gridpattern-package.Rd @@ -6,7 +6,7 @@ \alias{gridpattern-package} \title{gridpattern: 'grid' Pattern Grobs} \description{ -\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} +\if{html}{\figure{logo.svg}{options: style='float: right' alt='logo' width='120'}} Provides 'grid' grobs that fill in a user-defined area with various patterns. Includes enhanced versions of the geometric and image-based patterns originally contained in the 'ggpattern' package as well as original 'pch', 'polygon_tiling', 'regular_polygon', 'rose', 'text', 'wave', and 'weave' patterns plus support for custom user-defined patterns. } @@ -50,6 +50,7 @@ Useful links: Authors: \itemize{ + \item Trevor L. Davis \email{trevor.l.davis@gmail.com} (\href{https://orcid.org/0000-0001-6341-4639}{ORCID}) \item Mike FC (Code/docs adapted from ggpattern) } diff --git a/man/patternFill.Rd b/man/patternFill.Rd index 43f42f6..9a4f745 100644 --- a/man/patternFill.Rd +++ b/man/patternFill.Rd @@ -20,7 +20,7 @@ patternFill( \arguments{ \item{...}{Passed to \code{\link[=patternGrob]{patternGrob()}}.} -\item{x, y, width, height}{The size of the \code{\link[grid:patterns]{grid::pattern()}} tile.} +\item{x, y, width, height}{The size of the \code{\link[grid:pattern]{grid::pattern()}} tile.} \item{default.units}{The default \code{\link[grid:unit]{grid::unit()}} unit to use for \code{x}, \code{y}, \code{width}, and \code{height}.} @@ -29,10 +29,10 @@ patternFill( \item{group}{A logical indicating whether the pattern is relative to the bounding box of the grob or whether it is relative to individual shapes within the grob. Ignored if R is less than version 4.2.} } \value{ -A \code{\link[grid:patterns]{grid::pattern()}} fill object. +A \code{\link[grid:pattern]{grid::pattern()}} fill object. } \description{ -\code{patternFill()} returns \code{\link[grid:patterns]{grid::pattern()}} fill objects. +\code{patternFill()} returns \code{\link[grid:pattern]{grid::pattern()}} fill objects. It is a wrapper around \code{\link[=patternGrob]{patternGrob()}}. } \examples{ diff --git a/man/pattern_hex.Rd b/man/pattern_hex.Rd index 98ab57f..a5d18fa 100644 --- a/man/pattern_hex.Rd +++ b/man/pattern_hex.Rd @@ -1,13 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/pattern_hex.R -\docType{data} \name{pattern_hex} \alias{pattern_hex} \alias{names_hex} \title{Hex pattern matrix} -\format{ -An object of class \code{character} of length 5. -} \usage{ pattern_hex(type = "hex", subtype = NULL, nrow = 5L, ncol = 5L) @@ -74,4 +70,3 @@ this both the "hex" and "hex_circle" types \code{vignette("tiling", package = "g For more information on uniform colorings of a hexagonal tiling see \url{https://en.wikipedia.org/wiki/Hexagonal_tiling#Uniform_colorings}. } -\keyword{datasets} diff --git a/man/pattern_square.Rd b/man/pattern_square.Rd index 7be04af..295cede 100644 --- a/man/pattern_square.Rd +++ b/man/pattern_square.Rd @@ -1,13 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/pattern_square.R -\docType{data} \name{pattern_square} \alias{pattern_square} \alias{names_square} \title{Square pattern matrix} -\format{ -An object of class \code{character} of length 6. -} \usage{ pattern_square(type = "diagonal", subtype = NULL, nrow = 5L, ncol = 5L) @@ -102,4 +98,3 @@ See \code{\link[=pattern_weave]{pattern_weave()}} for more details about support polygons in multiple color/size/shape patterns. \code{\link[=pattern_weave]{pattern_weave()}} for more information on "weave" patterns. } -\keyword{datasets} diff --git a/man/pattern_weave.Rd b/man/pattern_weave.Rd index 52b9076..f70ff82 100644 --- a/man/pattern_weave.Rd +++ b/man/pattern_weave.Rd @@ -1,13 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/pattern_weave.R -\docType{data} \name{pattern_weave} \alias{pattern_weave} \alias{names_weave} \title{Weave pattern matrix} -\format{ -An object of class \code{character} of length 10. -} \usage{ pattern_weave(type = "plain", subtype = NULL, nrow = 5L, ncol = 5L) @@ -111,4 +107,3 @@ for further information on the "twill" family of weaves, and \url{https://texwiz101.blogspot.com/2012/03/features-and-classification-of-satin.html} for further information on "satin" weaves. } -\keyword{datasets}