Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8ada7a

Browse files
committed
Fix clipping of axis artist Ticks.
Instead of clipping the entire path+marker to the gc's clip path (which is inside the Axes only), clip the *position* of the path (aka marker). They then stay within the Axes, but don't get clipped if outgoing.
1 parent 31bfeb4 commit d8ada7a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ def draw(self, renderer):
310310

311311

312312
gc = renderer.new_gc()
313-
self._set_gc_clip(gc)
314313
gc.set_foreground(self.get_markeredgecolor())
315314
gc.set_linewidth(self.get_markeredgewidth())
316315
gc.set_alpha(self._alpha)
@@ -327,11 +326,13 @@ def draw(self, renderer):
327326
marker_transform = marker_scale + marker_rotation
328327

329328
for loc, angle in self.locs_angles:
330-
marker_rotation.rotate_deg(angle+add_angle)
329+
marker_rotation.clear().rotate_deg(angle+add_angle)
331330
locs = path_trans.transform_non_affine([loc])
331+
if (self.axes and
332+
not self.axes.viewLim.contains(locs[0][0], locs[0][1])):
333+
continue
332334
renderer.draw_markers(gc, self._tickvert_path, marker_transform,
333335
Path(locs), path_trans.get_affine())
334-
marker_rotation.clear()
335336

336337
gc.restore()
337338

0 commit comments

Comments
 (0)