This submission updates the popular submission (#30733) by Neil Tandon to place hatching pattern on patch objects. The main algorithm to form hatching pattern remains mostly the same as the original while more formatting options are exposed to the user and hatchfill2 brings the support for HG2 graphics system (since R2014b).
* Supported base graphics objects: PATCH, HGGROUP, AREA, BAR, and CONTOUR objects are additionally supported. Pre-HG2 (pre-R2014b) MATLAB releases are no longer supported.
* Supports 3D surfaces. Note: Hatching would not come out correctly on a curved surface.
* Four types of hatching patterns:
- 'single' single lines
- 'cross' double-crossed hatch
- 'speckle' speckling inside the patch boundary (partial support)
- 'outspeckle' speckling outside the boundary (partial support)
* User-definable options are now set via parameter name/value pair input argument interface. Options include HatchAngle, HatchDensity, HatchOffset, HatchColor, HatchLineStyle, HatchLineWidth, SpeckleMarkerStyle, and SpeckleFillColor
* Active formatting - the hatch line object listens to the changes in the patch object or axes to keep the hatching true to user options all the time (sans print support at this time)
* Basic graphics object properties (Visible, Clipping, HitTest, Interruptible, BusyAction, and UIContextMenu) of the hatch line object are synchronized to the base patch object. Only Visible property can be de-linked by setting HatchVisible option to either 'on' or 'off'.
* Speckling multi-face PATCH and HG2 CONTOUR is not implemented correctly. If anyone needs this feature fixed, post a request and I'll see what I can do.
* Print support - implementing "printmode" similar to lateximage
* Multi-face speckle support - eliminating all the interior edges in gethgdata
* Legend support - HG2 is making this really challenging if not impossible. Users suggest using legendflex (FEX#31092 or at https://github.com/kakearney/legendflex-pkg). See the comments below by Drecalde & SeungHyoung Ryu for how-to. Thanks guys!!
Kesh Ikuma (2022). Hatchfill2 (https://www.mathworks.com/matlabcentral/fileexchange/53593-hatchfill2), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!