fillpattern (development version)
New Features
-
Pattern Name Lists:
fill_pattern_nameslists the 14 base pattern names, andfill_pattern_orderlists the 35 patterns that numbers (and the defaultscale_fill_pattern(patterns = seq_len)) map to (trevorld/gridpattern#141). -
Palette Function: New
pal_fill_pattern()returns the palette thatscale_fill_pattern()uses, fortheme(palette.fill.discrete = )in ggplot2 4.0 or later, or for other packages’ scales (trevorld/gridpattern#141). -
Color Palette Functions:
fill_pattern()now accepts a function for any argument exceptpatternsandfun, called with the number of patterns, likescale_fill_pattern()already did. So a color palette such asbg = hcl.colorsgives each pattern its own color. -
No Lines:
lwd = 0, or the"_0lwd"pattern modifier, now draws no pattern lines (trevorld/gridpattern#141). -
More Line Types:
ltyaccepts every line type that?pardoes: the six names,"blank", the integers 0 to 6, and hex dash patterns such as"44"or"1342"(#11).
Bug Fixes
-
Palette Functions in the Scale:
scale_fill_pattern(fg = <function>)no longer warns “is.na() applied to non-(list or vector) of type ‘closure’”. Thebgandfadedefaults are nowNULL, and are worked out afterfgis evaluated, with the same results as before. -
Invalid Arguments: Invalid arguments, such as a misspelled pattern name or an unsupported
lty, no longer silently draw a solid block. They now give a warning when the pattern is created and are replaced with the default for that argument; an invalid pattern name keeps its valid parts, so"stripes45"becomes"brick45".fillPatternGrob()uses the first value of a longer argument, with a warning, instead of an error. Shapes smaller thanmin_sizeare still filled with solidfgcolor, without a warning, and now use the shape’s outline color whenfg = NA. Any other failure to draw a pattern warns once per session (#11). -
Pattern and Grob Backgrounds:
bgcan now be a grid pattern, such asgrid::linearGradient()or anotherfill_pattern(), passed directly or in a list, e.g.bg = list(grad, "cyan"). Previously,fill_pattern()andscale_fill_pattern()split the pattern into its components and quietly drew the wrong colors, andfillPatternGrob()errored. A grobbgis now drawn as-is instead of being replaced by a solidfg-colored rectangle (#10).
fillpattern 1.0.5
CRAN release: 2026-11-18
New Features
-
Other Aesthetics and Scale Options:
scale_fill_pattern()gainsaestheticsand...arguments. Useaesthetics = "pattern_fill"for ‘ggpattern’ geoms, and passname,labels,breaks,limits,guide, etc. through toggplot2::discrete_scale()(#8). -
Inherited Colors:
fill_pattern(fg = NA)andfill_pattern(bg = NA)now take their color from the outline (col) of the shape being filled.
Bug Fixes
-
Extension Geoms:
scale_fill_pattern()no longer errors in geoms that don’t callggplot2::fill_alpha(), such asggalluvial::geom_alluvium(). The scale’s palette now returns realgrid::pattern()objects. In those geoms,NAcolors come from the shape’s outline color, or fall back to black lines on white (#7). -
Color Lookup: The
colouraesthetic lookup no longer depends on a fixed call-stack depth. It now finds the data in the frame that calledggplot2::fill_alpha(). -
Transparent Colors: A fully transparent
colour(e.g. ‘ggalluvial’’s default) is now treated as missing, so patterns stay visible.
fillpattern 1.0.3
CRAN release: 2026-02-13
Dependency Changes
- R Version Requirement: Bumped the minimum required R version from 4.1.0 to 4.2.0 to ensure compatibility with recent graphics engine features.
Bug Fixes
-
Size Parsing: Fixed a bug where size modifier strings ending in a colon (e.g.,
"brick_8mm:") were parsed incorrectly, applying the width dimension to the height. -
Unit Validation:
modify_size()now gracefully handles and reports invalid unit strings instead of crashing, and includes support for standard units like"in","inches", and"cm". -
Background Color: Fixed an issue in
scale_fill_pattern()where the background color was not correctly calculated from the aesthetic mapping when a foreground color was manually specified.
fillpattern 1.0.2
CRAN release: 2024-06-24
- Fixed crash on very small fill areas.
- New parameter
min_sizeto use solid fills for small areas.
