(self, renderer)
| 753 | |
| 754 | @allow_rasterization |
| 755 | def draw(self, renderer): |
| 756 | # docstring inherited |
| 757 | |
| 758 | if not self.get_visible(): |
| 759 | return |
| 760 | |
| 761 | if self._invalidy or self._invalidx: |
| 762 | self.recache() |
| 763 | self.ind_offset = 0 # Needed for contains() method. |
| 764 | if self._subslice and self.axes: |
| 765 | x0, x1 = self.axes.get_xbound() |
| 766 | i0 = self._x_filled.searchsorted(x0, 'left') |
| 767 | i1 = self._x_filled.searchsorted(x1, 'right') |
| 768 | subslice = slice(max(i0 - 1, 0), i1 + 1) |
| 769 | self.ind_offset = subslice.start |
| 770 | self._transform_path(subslice) |
| 771 | else: |
| 772 | subslice = None |
| 773 | |
| 774 | if self.get_path_effects(): |
| 775 | from matplotlib.patheffects import PathEffectRenderer |
| 776 | renderer = PathEffectRenderer(self.get_path_effects(), renderer) |
| 777 | |
| 778 | renderer.open_group('line2d', self.get_gid()) |
| 779 | if self._lineStyles[self._linestyle] != '_draw_nothing': |
| 780 | tpath, affine = (self._get_transformed_path() |
| 781 | .get_transformed_path_and_affine()) |
| 782 | if len(tpath.vertices): |
| 783 | gc = renderer.new_gc() |
| 784 | self._set_gc_clip(gc) |
| 785 | gc.set_url(self.get_url()) |
| 786 | |
| 787 | gc.set_antialiased(self._antialiased) |
| 788 | gc.set_linewidth(self._linewidth) |
| 789 | |
| 790 | if self.is_dashed(): |
| 791 | cap = self._dashcapstyle |
| 792 | join = self._dashjoinstyle |
| 793 | else: |
| 794 | cap = self._solidcapstyle |
| 795 | join = self._solidjoinstyle |
| 796 | gc.set_joinstyle(join) |
| 797 | gc.set_capstyle(cap) |
| 798 | gc.set_snap(self.get_snap()) |
| 799 | if self.get_sketch_params() is not None: |
| 800 | gc.set_sketch_params(*self.get_sketch_params()) |
| 801 | |
| 802 | # We first draw a path within the gaps if needed, but only for |
| 803 | # visible dashed lines; zero-width lines would otherwise yield |
| 804 | # all-zero dashes. |
| 805 | if (self._linewidth > 0 and self.is_dashed() |
| 806 | and self._gapcolor is not None): |
| 807 | lc_rgba = mcolors.to_rgba(self._gapcolor, self._alpha) |
| 808 | gc.set_foreground(lc_rgba, isRGBA=True) |
| 809 | |
| 810 | offset_gaps, gaps = _get_inverse_dash_pattern( |
| 811 | *self._dash_pattern) |
| 812 |
no test coverage detected