Releases: trevorld/gridpattern
gridpattern v0.2.1
Breaking Changes
- "array" patterns no longer set a minimum 12 pixel image width and/or height.
In particular, they can now have a zero pixel image width and/or height
(in which case the array pattern returns agrid::nullGrob()
). - "array" patterns no longer reduces the number of requested pixels when
legend = TRUE
.
New Features
-
Supports the following new patterns:
-
names_pattern
is a new character vector of supported (builtin) patterns. -
clippingPathGrob()
is a function that clips one grob according to clipping path set by a second grob.- If
use_R4.1_clipping
isTRUE
we simply use the new R 4.1 clipping path feature - If
use_R4.1_clipping
isFALSE
we generate agrid::rasterGrob()
approximation - If
use_R4.1_clipping
isNULL
try to guess an appropriate choice. - The default for
use_R4.1_clipping
can be set byoptions("ggpattern_use_R4.1_clipping")
- If
-
grid.pattern_gradient()
now supports the argumentuse_R4.1_gradients
- If
TRUE
use the new R 4.1 gradient feature - If
FALSE
use arasterGrob
approximation (old behaviour) - If
NULL
try to guess an appropriate choice. - The default for
use_R4.1_gradients
can be set byoptions("ggpattern_use_R4.1_gradients")
- If
-
The following package options can now be set by
options()
:ggpattern_use_R4.1_clipping
IfTRUE
use the grid clipping path feature introduced in R v4.1.0.
IfFALSE
do arasterGrob
approximation of the clipped pattern.
Currently used byclippingPathGrob()
,grid.pattern_rose()
,
grid.pattern_text()
, and available for custom patterns.ggpattern_use_R4.1_features
Set the default for all the other
ggpattern_use_R4.1_*
options arguments.ggpattern_use_R4.1_gradients
IfTRUE
use the grid gradient feature introduced in R v4.1.0.
IfFALSE
do arasterGrob
approximation of the gradient pattern.
Currently used bygrid.pattern_gradient()
and available for custom patterns.ggpattern_use_R4.1_masks
IfTRUE
use the grid mask feature introduced in R v4.1.0.
Currently unused by this package but available for custom patterns.ggpattern_use_R4.1_patterns
IfTRUE
use the grid pattern feature introduced in R v4.1.0.
Currently unused by this package but available for custom patterns.
Bug fixes and minor improvements
grid.pattern()
now throws an error if there is a non-unique pattern name
(set byoptions("ggpattern_geometry_funcs")
and/oroptions("ggpattern_array_funcs")
).- Fixes an error when catching a {magick} image reading error
for some array patterns.
gridpattern v0.1.2
-
grid.pattern()
draws a specified "pattern" to the active graphics device
whilepatternGrob()
returns a "pattern" (grid) grob. -
Supports the following original patterns:
-
Supports the following patterns from ggpattern:
- "ambient"
grid.pattern_ambient()
- "circle"
grid.pattern_circle()
(#5) - "crosshatch"
grid.pattern_crosshatch()
(#4) - "gradient"
grid.pattern_gradient()
(#8) - "image"
grid.pattern_image()
(#9) - "magick"
grid.pattern_magick()
(#6) - "none"
grid::null()
- "placeholder"
grid.pattern_placeholder()
(#10) - "plasma"
grid.pattern_plasma()
(#7) - "stripe"
grid.pattern_stripe()
(#3) - Custom ggpattern geometry-based patterns (#1)
- Custom ggpattern array-based patterns (#2)
Enhancements made to the
{ggpattern}
patterns provided by this package:-
Resolution of "array" patterns is now settable by new "pattern_res".
Defaults to 72 pixels per inch but sets a minimum 12 pixel image width and/or height. -
Default for "pattern_alpha" is now
NA_real_
(preserve existing alpha transparency) instead of1
(set to fully opaque). -
grid.pattern_ambient()
pattern supports all arguments of the six{ambient}
"noise" functions. -
grid.pattern_circle()
has several enhancements:- Allows use of the argument
xoffset
andyoffset
(#22) - Allows use of arguments
grid
,type
, andsubtype
to customize the pattern arrangement. - Use of multiple
fill
colors now produces a more attractive pattern. - Use of
density
greater than1
will now sometimes give an attractive result (#17). - Uses
{sf}
to clip circles to boundary instead of{gridGeometry}
- Allows use of the argument
-
grid.pattern_crosshatch()
allows using the argumentfill2
to set
different fill color(s) for the "over" crosshatch lines (#14). -
xoffset
,yoffset
, andspacing
are now interpreted as "snpc" units and
grid.pattern_stripe()
andgrid.pattern_crosshatch()
now allow using the
argumentgrid
to tweak placement of lines so that they now match the placement
of circles fromgrid.pattern_circle()
and polygons fromgrid.pattern_regular_polygon()
(#24). -
The center point of the geometry "grid" now matches the center of the viewport.
- "ambient"
-
mean_col()
is a utility function that computes an "average" color (#21) -
star_scale()
andstar_angle()
are utility functions for converting
between regular star polygon parameterizations (#39). -
pattern_hex()
returns an integer matrix indicating placement of multiple
colors (or other graphical elements) on a hex grid. Supports types listed inhex_names
. -
pattern_square()
returns an integer matrix indicating placement of multiple
colors (or other graphical elements) on a rectangular grid. Supports types listed insquare_names
. -
pattern_weave()
returns a logical matrix indicating where the warp
lines should "up" for a specified weave pattern type and subtype. Supports
weaves listed inweave_names
. In particular supports "irregular matt" and
"elongated twill" family of weave patterns including "zig-zag" and
"herringbone" variations.