From 8930d21bc4f72db3132aca7ba724fbd02499faf2 Mon Sep 17 00:00:00 2001 From: Arikad0 <132415954+Arikad0@users.noreply.github.com> Date: Thu, 16 Nov 2023 18:51:06 -0300 Subject: [PATCH] Update hatch.py --- lib/matplotlib/hatch.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/hatch.py b/lib/matplotlib/hatch.py index 9ec88776cfd3..6ddce160fb22 100644 --- a/lib/matplotlib/hatch.py +++ b/lib/matplotlib/hatch.py @@ -167,6 +167,22 @@ def __init__(self, hatch, density): self.shape_codes[0] = Path.MOVETO super().__init__(hatch, density) +class DashedHatch(HatchPatternBase): + def __init__(self, hatch, density): + self.num_lines = int((hatch.count('_') + hatch.count('+')) * density) + self.num_vertices = self.num_lines * 2 + + def set_vertices_and_codes(self, vertices, codes): + steps, stepsize = np.linspace(0.0, 1.0, self.num_lines, False, + retstep=True) + steps += stepsize / 2. + vertices[0::2, 0] = steps + vertices[0::2, 1] = 0.0 + vertices[1::2, 0] = steps + vertices[1::2, 1] = 1.0 + codes[0::2] = Path.MOVETO + codes[1::2] = Path.LINETO + _hatch_types = [ HorizontalHatch, VerticalHatch, @@ -175,12 +191,13 @@ def __init__(self, hatch, density): SmallCircles, LargeCircles, SmallFilledCircles, - Stars + Stars, + DashedHatch ] 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:
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: