Skip to content

Support parallel line hatching at arbitrary angle and line density #20029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joshmillard opened this issue Apr 20, 2021 · 1 comment
Open
Labels
keep Items to be ignored by the “Stale” Github Action New feature topic: hatch

Comments

@joshmillard
Copy link

Problem

While matplotlib currently provides a degree of hatch fill functionality with set_hatch, fine control of the angle and density of hatch lines isn't straightforward. The current functionality only directly allows the parallel hatch lines at horizontal, vertical, or 45 degree diagonal orientations, and the density of those lines is expressed implicitly by strings of repeating symbols (e.g. "/" for a sparse diagonal hatch, "///" for a more dense one, etc).

Hatch patterns are also currently tied to the shape they're filling, whereas an independent collection of lines would be more flexible for further graphical manipulation.

Proposed Solution

My suggestion is a distinct method for generating a hatch of parallel lines, based on a target shape, accepting numeric angle and density values. I'm imagining this functioning as something like another item in the matplotlib.patches family, invoked along the lines of

matplotlib.patches.Hatch(bounding_polygon, angle, size)

where bounding_polygon is e.g. a Polygon patch, angle is the orientation angle to which the hatch lines run parallel, and size is a gap between each hatch line along the axis perpendicular to the orientation angle.

The result would be a new patch object consisting of some number of line segments that effectively fill the original shape's interior area with hatching lines but which exists as its own independent patch.

Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Dec 11, 2023
@story645 story645 added keep Items to be ignored by the “Stale” Github Action and removed status: inactive Marked by the “Stale” Github Action labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep Items to be ignored by the “Stale” Github Action New feature topic: hatch
Projects
None yet
Development

No branches or pull requests

3 participants