Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Moved _set_hatch_linewidth to backend_bases
  • Loading branch information
Impaler343 committed Oct 24, 2024
commit 05300fe36eb4b4a1114cc2693276a35bc52b926a
10 changes: 10 additions & 0 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,16 @@ def set_hatch_linewidth(self, hatch_linewidth):
"""Set the hatch linewidth."""
self._hatch_linewidth = hatch_linewidth

def _set_hatch_linewidth(self, hatch_linewidth):
if hasattr(self, "set_hatch_linewidth"):
self.set_hatch_linewidth(hatch_linewidth)
else:
_api.warn_deprecated(
Comment thread
Impaler343 marked this conversation as resolved.
Outdated
"3.8", message="The current backend does not define "
"GraphicsContextRenderer.set_hatch_linewidth; support for such "
"backends is deprecated since %(since)s and will be removed "
"%(removal)s.")

def get_sketch_params(self):
"""
Return the sketch parameters for the artist.
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/backend_bases.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class GraphicsContextBase:
def get_hatch_color(self) -> ColorType: ...
def set_hatch_color(self, hatch_color: ColorType) -> None: ...
def get_hatch_linewidth(self) -> float: ...
def set_hatch_linewidth(self, hatch_linewidth: float) -> None: ...
def get_sketch_params(self) -> tuple[float, float, float] | None: ...
def set_sketch_params(
self,
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,7 @@ def draw(self, renderer):
if self._hatch:
gc.set_hatch(self._hatch)
gc.set_hatch_color(self._hatch_color)
print(self._hatch_linewidth)
print(self.get_hatch_linewidth())
mhatch._set_hatch_linewidth(gc, self.get_hatch_linewidth())
gc._set_hatch_linewidth(self._hatch_linewidth)

if self.get_sketch_params() is not None:
gc.set_sketch_params(*self.get_sketch_params())
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def _draw_paths_with_artist_properties(
if self._hatch:
gc.set_hatch(self._hatch)
gc.set_hatch_color(self._hatch_color)
mhatch._set_hatch_linewidth(gc, self.get_hatch_linewidth())
gc._set_hatch_linewidth(self._hatch_linewidth)

if self.get_sketch_params() is not None:
gc.set_sketch_params(*self.get_sketch_params())
Expand Down