fill_charcoal() is a fill_noise() preset – same field, same
rendering, just different defaults – tuned to read as hand-drawn
charcoal or marker grain rather than fill_noise()'s more
general-purpose rasterized field: a lighter base tone, finer/denser
tiling, and finer noise detail.
Usage
fill_charcoal(
color = "gray15",
spacing = 0.25,
aspect = NULL,
resolution = 32L,
alpha = 1,
frequency = 4,
octaves = 3L,
seed = 1L,
extend = "repeat"
)Arguments
- color
One or more fill colours, as in
fill_noise(). Default"gray15"(lighter thanfill_noise()'s own"black"default, closer to a charcoal tone).- spacing
Baseline tile size, as a fraction of the target's bounding box. Must be a positive number. Default
0.25(finer thanfill_noise()'s own0.5default, for denser grain).- aspect
Width-to-height ratio of the target polygon's bounding box. Must be a positive number, or
NULL(the default) to resolve it automatically from the real target's own bounding-box aspect ratio atdraw()time – see the fill class. Passing a fixed number instead computes the pattern once, immediately, against that value only.- resolution
Raster resolution (pixels per tile edge). Must be a positive integer of at least
2L. Default32L.- alpha
Opacity. For a single
color, the maximum opacity at the noise field's peak; for two or more, a flat opacity applied uniformly. Must be a number in(0, 1]. Default1.- frequency
Noise frequency, as in
shape_blob(). Must be non-negative. Default4(finer detail thanfill_noise()'s own default of1).- octaves
Number of noise octaves, as in
shape_blob(). Must be a positive integer. Default3L(one more layer of detail thanfill_noise()'s own default of2L).- seed
Integer seed for the noise field, as in
shape_blob(). Default1L.- extend
Passed to
grid::pattern(). Default"repeat".
Value
A pattern object as returned by grid::pattern(), suitable for
use as the fill argument to grid::gpar().
Details
Found, while prototyping shape_stroke()'s interior texture, to be a
substantially better fit than fill_scribble() for a curved stroke's
body – fill_scribble()'s angle is a single fixed value for the
whole tile (and only tiles exactly seamlessly at a multiple of 90
degrees; see its "Known limitation" docs section), so it can't track a
curved path's own continuously-varying tangent, producing hatching that
visibly cuts across the stroke at odd angles wherever the path bends,
while fill_noise()'s directionless mottling has no orientation to
clash with the curve.
Examples
draw(shape_stroke(
x = c(0, 1, 2, 3), y = c(0, 1, 0, 1), width = 0.4,
fill = fill_charcoal(), color = NA_character_
))
# a lighter tone and a curved backbone -- fill_charcoal()'s directionless
# mottling tracks a bend that fill_scribble()'s fixed direction wouldn't
t <- seq(0, 2 * pi, length.out = 200)
draw(shape_stroke(
x = t, y = sin(t), width = 0.3,
fill = fill_charcoal(color = "gray40"), color = NA_character_
))