MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _draw_paths_with_artist_properties

Method _draw_paths_with_artist_properties

lib/matplotlib/patches.py:672–733  ·  view source on GitHub ↗

``draw()`` helper factored out for sharing with `FancyArrowPatch`. Configure *renderer* and the associated graphics context *gc* from the artist properties, then repeatedly call ``renderer.draw_path(gc, *draw_path_args)`` for each tuple *draw_path_args* in *

(
            self, renderer, draw_path_args_list)

Source from the content-addressed store, hash-verified

670 return self._linestyle not in ('solid', '-')
671
672 def _draw_paths_with_artist_properties(
673 self, renderer, draw_path_args_list):
674 """
675 ``draw()`` helper factored out for sharing with `FancyArrowPatch`.
676
677 Configure *renderer* and the associated graphics context *gc*
678 from the artist properties, then repeatedly call
679 ``renderer.draw_path(gc, *draw_path_args)`` for each tuple
680 *draw_path_args* in *draw_path_args_list*.
681 """
682
683 renderer.open_group('patch', self.get_gid())
684 gc = renderer.new_gc()
685
686 lw = self._linewidth
687 if self._edgecolor[3] == 0 or self._linestyle == 'None':
688 lw = 0
689 gc.set_linewidth(lw)
690 gc.set_capstyle(self._capstyle)
691 gc.set_joinstyle(self._joinstyle)
692
693 gc.set_antialiased(self._antialiased)
694 self._set_gc_clip(gc)
695 gc.set_url(self._url)
696 gc.set_snap(self.get_snap())
697
698 gc.set_alpha(self._alpha)
699
700 if self._hatch:
701 gc.set_hatch(self._hatch)
702 gc.set_hatch_color(self.get_hatchcolor())
703 gc.set_hatch_linewidth(self._hatch_linewidth)
704
705 if self.get_sketch_params() is not None:
706 gc.set_sketch_params(*self.get_sketch_params())
707
708 if self.get_path_effects():
709 from matplotlib.patheffects import PathEffectRenderer
710 renderer = PathEffectRenderer(self.get_path_effects(), renderer)
711
712 # We first draw a path within the gaps if needed, but only for visible
713 # dashed edges; zero-width edges would otherwise yield all-zero dashes.
714 if lw > 0 and self._has_dashed_edge() and self._gapcolor is not None:
715 gc.set_foreground(self._gapcolor, isRGBA=True)
716 offset_gaps, gaps = mlines._get_inverse_dash_pattern(
717 *self._dash_pattern)
718 gc.set_dashes(offset_gaps, gaps)
719 for draw_path_args in draw_path_args_list:
720 renderer.draw_path(gc, *draw_path_args)
721
722 # Draw the main edge
723 gc.set_foreground(self._edgecolor, isRGBA=True)
724 if lw > 0:
725 gc.set_dashes(*self._dash_pattern)
726 else:
727 gc.set_dashes(0, None)
728 for draw_path_args in draw_path_args_list:
729 renderer.draw_path(gc, *draw_path_args)

Callers 2

drawMethod · 0.95
drawMethod · 0.80

Calls 15

open_groupMethod · 0.95
get_hatchcolorMethod · 0.95
_has_dashed_edgeMethod · 0.95
draw_pathMethod · 0.95
close_groupMethod · 0.95
PathEffectRendererClass · 0.90
_set_gc_clipMethod · 0.80
set_hatch_colorMethod · 0.80
get_path_effectsMethod · 0.80
get_gidMethod · 0.45
new_gcMethod · 0.45
set_linewidthMethod · 0.45

Tested by

no test coverage detected