Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Open
@joshmillard

Description

@joshmillard
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.