FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

added dashed hatch pattern by ShivamPathak99 · Pull Request #28072 · matplotlib/matplotlib · GitHub

Repository navigation

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

Filter by extension

Filter by extension .py  (1) .pyi  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 14 additions & 2 deletions lib/matplotlib/hatch.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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: ...

Back | FazBrowse Home | New Git URL