Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: gridpattern
Type: Package
Title: 'grid' Pattern Grobs
Version: 1.4.0-2
Version: 1.4.0-3
Authors@R: c(
person("Trevor L.", "Davis", role=c("aut", "cre"), email="trevor.l.davis@gmail.com",
comment = c(ORCID = "0000-0001-6341-4639")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export(names_pattern)
export(names_placeholder)
export(names_polygon_tiling)
export(names_square)
export(names_wave)
export(names_weave)
export(patternFill)
export(patternGrob)
Expand Down
21 changes: 19 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
gridpattern v1.4.0 (development)
================================

Breaking Changes
----------------

* The `"indented"` (formerly `"triangle"`) wave type now uses a wider stroke
in order to better match the apparent stroke widths of the new wave types.
Users who relied on the previous visual appearance should reduce `density`
to compensate.

New Features
------------

Expand All @@ -12,13 +20,22 @@ New Features
enabling all of R's built-in `linetype` values
(including `"dotdash"`, `"twodash"`, and custom line types specified as hex strings per `?par`).

* `mix_col()` is a new utility function that mixes colors via Munsell color
space using `aqp::mixMunsell()`.
* The preexisting "wave" pattern gains ten new `type` values, a `reverse` parameter, a `stagger` parameter, and `names_wave` (#100, #101).

* New `mix_col()` that mixes colors via Munsell color space using `aqp::mixMunsell()`.
Requires the suggested package `{aqp}`.

Bug fixes and minor improvements
--------------------------------

* Fixes a bug where the `"sine"` (aliases `"wavy"`, `"undy"`) and `"triangle"` wave
types had an effective wavelength of `(n-1)/n` times the requested wavelength,
where `n` is the number of wavelength-spaced grid positions spanning the viewport.
The error was most visible when only a few periods were displayed
(e.g. `spacing ≈ wavelength`), where the period was up to 20% too short.
As a side effect, these wave types now have their peaks correctly phase-aligned
with the other wave types (peak at one quarter of the wavelength from the left edge).

* Fixes a bug where geometry-based patterns (e.g. "stripe", "crosshatch", "wave")
could silently disappear in small viewports when `pattern_key_scale_factor`
was a relatively large value (#95).
Expand Down
2 changes: 1 addition & 1 deletion R/pattern-both-line.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' 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.
#' @seealso [grid.pattern_stripe()] for filled bands, [grid.pattern_wave()] for wavy bands, [grid.pattern_crosshatch()] for two sets of lines.
#' @export
grid.pattern_line <- function(
x = c(0, 0, 1, 1),
Expand Down
8 changes: 2 additions & 6 deletions R/pattern-geometry-crosshatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ create_h_stripes_sf <- function(params, grid_xy, vpm) {
l_rects <- lapply(grid_xy$y, function(y0) {
x <- c(grid_xy$x_min, grid_xy$x_min, grid_xy$x_max, grid_xy$x_max)
y <- y0 + c(-1, 1, 1, -1) * halfwidth
xy <- rotate_xy(x, y, params$pattern_angle, vpm$x, vpm$y)
m <- as.matrix(as.data.frame(xy))
list(rbind(m, m[1, ]))
polygon_ring(x, y, params$pattern_angle, vpm)
})
sf::st_multipolygon(l_rects)
}
Expand All @@ -138,9 +136,7 @@ create_v_stripes_sf <- function(params, grid_xy, vpm) {
l_rects <- lapply(grid_xy$x, function(x0) {
x <- x0 + c(-1, 1, 1, -1) * halfwidth
y <- c(grid_xy$y_min, grid_xy$y_min, grid_xy$y_max, grid_xy$y_max)
xy <- rotate_xy(x, y, params$pattern_angle, vpm$x, vpm$y)
m <- as.matrix(as.data.frame(xy))
list(rbind(m, m[1, ]))
polygon_ring(x, y, params$pattern_angle, vpm)
})
sf::st_multipolygon(l_rects)
}
1 change: 1 addition & 0 deletions R/pattern-geometry-stripe.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' 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.
#' Use [grid.pattern_wave()] for wavy bands instead of straight ones.
#' @export
grid.pattern_stripe <- function(
x = c(0, 0, 1, 1),
Expand Down
Loading
Loading