Changelog
Source:NEWS.md
ggpatchy 0.6.1
Bug fixes
- Named density variants (
hatch_dense,hatch_sparse,dots_dense, etc.) now render correctly. Under the mm spacing model,default_aesalways fillspattern_spacing = 5before the variant function is called, so the old%||%-based multiplier never fired — every variant rendered identically to its base pattern. Fixed by comparing the incoming spacing to.PATTERN_SPACING_DEFAULTwithall.equal()and applying the multiplier only when the value is the package default, not a user override.
Documentation fixes
-
NEWS.md0.6.0 legend bullet corrected: legend swatches continue to useTARGET_REPS-based spacing (not data spacing). The previous bullet incorrectly claimed this behaviour had changed. -
pattern_spacingandpattern_sizedocs ingeom_density_pattern()updated from stale npc-era values (0.08,0.4) to current mm defaults (5,0.5). -
README.mdparameter table and custom-pattern example updated to mm semantics. - Vignette
pattern_spacingvalues updated from npc-era fractions to mm. -
ROADMAP.mdcurrent-state section updated to v0.6.1; shipped items moved.
ggpatchy 0.6.0
Breaking changes
-
pattern_spacingnow specifies spacing in millimetres (previously a dimensionless fraction of each shape’s bounding box). The default changes from0.08to5mm. Update existing code that setspattern_spacingexplicitly:0.08→5,0.04(dense) →2.5,0.16(sparse) →10, or similar. -
pattern_sizefor the"dots"pattern is now the dot radius in millimetres (previously dimensionless). Default changes from0.4to0.5mm. - Legend key swatches continue to show approximately 3 pattern repetitions regardless of the
pattern_spacingvalue in use. This is deliberate: a very sparse spacing (e.g.20 mm) would otherwise produce a blank swatch. The legend communicates pattern type, not density.
Why this change
The previous bounding-box-relative model produced different visual densities across shapes of different physical sizes in the same plot — most visibly on choropleth maps where small and large regions received wildly different dot counts. Millimetre units resolve against device physical dimensions at draw time, independently of viewport size, giving uniform density across all shapes. See vignette("design-philosophy") for full details.
Interactive resizing
When resizing a plot window interactively, pattern density will appear to change as the physical dimensions change. This is correct — pattern_spacing = 5 always means 5mm regardless of window size. For consistent results, set chunk fig.width/fig.height to match your intended ggsave() dimensions.
Internal changes
-
makeContent.DotPatternTreeandmakeContent.LinePatternTreenow convert mm → npc viagrid::convertWidth/grid::convertHeightat draw time inside the active shape viewport (infrastructure introduced in v0.5.x).
ggpatchy 0.5.1
New features
- New exported function
pattern_contrast(colour1, colour2)returns the WCAG 2.1 contrast ratio between two colours. Useful for pre-validating colour choices programmatically. - New geom aesthetic
pattern_contrast_check: set to a numeric threshold (e.g.3.0for WCAG AA non-text) to receive a warning when any shape’spattern_colour/fillcontrast falls below it.TRUEis an alias for3.0. Default0(disabled, no behaviour change). - New geom aesthetic
pattern_contrast_correct: set toTRUEto automatically adjustpattern_colourluminance to just meet the contrast threshold before drawing. Correction is silent; the adjusted colour is used for rendering only and does not modify your data. DefaultFALSE. Whenpattern_contrast_correct = TRUEwithout an explicitpattern_contrast_check, the correction threshold defaults to3.0.
ggpatchy 0.5.0
New features
- Named density variants for all six base patterns:
hatch_dense,hatch_sparse,crosshatch_dense,crosshatch_sparse,horizontal_dense,horizontal_sparse,vertical_dense,vertical_sparse,dots_dense,dots_sparse,weave_dense,weave_sparse. Use these in place of any base pattern name to get a predictably tighter or looser spacing without settingpattern_spacingmanually. Explicitpattern_spacingvalues still override the variant default.
ggpatchy 0.4.1
Improvements
- Pattern spacing is now relative to each shape’s bounding box rather than the full panel.
pattern_spacing = 0.08now means “8% of the shape’s bounding box” consistently across shapes of any size. Previously, small shapes received sparse patterns and large shapes received dense ones with the same spacing value.
ggpatchy 0.4.0
Bug fixes and improvements
-
geom_polygon_pattern()andgeom_sf_pattern()now clip patterns to the exact polygon boundary using the R 4.1 graphics engine clip path API. On R ≥ 4.1 with a supporting device (ragg, Cairo PDF, SVG), hatch lines and dots are correctly contained within the polygon shape. The previous bounding-box-only clipping is retained as a fallback for older R.
ggpatchy 0.2.0
New geoms
-
geom_ribbon_pattern()andgeom_area_pattern()— ribbon and area charts with pattern overlays clipped to the ribbon polygon.GeomRibbonPatternoverridesdraw_groupto reconstruct the ribbon polygon from thecoord$transformoutput and feed it through the existingclip_segments_to_poly/pippattern clipper.geom_area_pattern()is a thinGeomAreaPatternsubclass that mirrorsGeomAreaby settingymin = 0,ymax = yinsetup_data;position = "stack"works correctly.
ggpatchy 0.1.0
Initial CRAN release.
Geoms
-
geom_col_pattern()— column charts with pattern overlays (extendsGeomRect). -
geom_bar_pattern()— bar charts usingstat = "count"(same underlying geom). -
geom_polygon_pattern()— arbitrary polygons with patterns clipped to the exact polygon boundary using in-R segment-polygon intersection and ray-casting point-in-polygon tests.
Patterns
Seven built-in patterns: none, hatch, crosshatch, horizontal, vertical, dots, weave. Custom patterns can be registered at runtime with register_pattern().
Scales
-
scale_pattern_manual()— explicit name-to-pattern mapping. -
scale_pattern_discrete()— cycles through built-in patterns automatically. -
scale_pattern_identity()— uses the column value directly as a pattern name.
Other
-
draw_key_pattern()— legend key renderer for pattern aesthetics. -
list_patterns()— list all registered pattern names.