Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lib/matplotlib/hatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ def __init__(self, hatch, density):
self.shape_codes[0] = Path.MOVETO
super().__init__(hatch, density)


class Dashes(Shapes):
size = 0.35

def __init__(self, hatch, density):
self.num_rows = (hatch.count('_')) * density
path = Path([[0, 0], [1, 0]], [Path.MOVETO, Path.LINETO])
self.shape_vertices = path.vertices
self.shape_codes = path.codes
super().__init__(hatch, density)

_hatch_types = [
HorizontalHatch,
VerticalHatch,
Expand All @@ -175,12 +186,13 @@ def __init__(self, hatch, density):
SmallCircles,
LargeCircles,
SmallFilledCircles,
Stars
Stars,
Dashes
]


def _validate_hatch_pattern(hatch):
valid_hatch_patterns = set(r'-+|/\xXoO.*')
valid_hatch_patterns = set(r'_-+|/\xXoO.*')
if hatch is not None:
invalids = set(hatch).difference(valid_hatch_patterns)
if invalids:
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/hatch.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@ class Stars(Shapes):
shape_codes: np.ndarray
def __init__(self, hatch: str, density: int) -> None: ...

class Dashes(Shapes):
size: float
num_rows: int
shape_vertices: np.ndarray
shape_codes: np.ndarray
def __init__(self, hatch: str, density: int) -> None: ...

def get_path(hatchpattern: str, density: int = ...) -> Path: ...
Loading