Skip to content

Define additional/custom hatches #20690

@mtb-za

Description

@mtb-za

Problem

The current set of hatching options within matplotlib is somewhat limited, being only the following, with the ability to make more dense ones.
image
In geoscience (and possibly other fields, but that is my background) there are a number of other hatching patterns that have long historical use and are still common, cf the USGS templates, available as a pdf here. Some of these are complex enough to be difficult to generate programmatically (eg 706: contorted schist), while others are much simpler (eg 328-K, which is a grid of offset +).

Is there a means to safely define hatches such the latter? A workaround, adding custom hatches to _hatch_types can be done but raises a deprecation warning (MatplotlibDeprecationWarning: hatch must consist of a string of "*+-./OX\ox|" or None, but found the following invalid values "p". Passing invalid values is deprecated since 3.4 and will become an error two minor releases later.) since PR #17926, and is therefore not a stable long-term solution.

Proposed Solution

It would be good to have a means to define custom hatches in a safe way. In many cases I think it likely to be package maintainers adding the functionality (as striplog does) rather than users.

A less comprehensive solution that would still cover many common use-cases would be to allow for repetitive hatching of a single (user-chosen) symbol. (That is, being able to place a regular grid of + or L in the way that the current hatches API handles cases like . and o.)

Additional context and prior art

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy