From f04557bffc5386db43b5a5bef6926d5fbdebea3b Mon Sep 17 00:00:00 2001 From: 2xB <2xB@users.noreply.github.com> Date: Wed, 21 Aug 2019 18:18:21 +0200 Subject: [PATCH] Clip annotations if annotation_clip is not False --- lib/matplotlib/axes/_axes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 40e48fd5512f..cb1104dae186 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -773,6 +773,10 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs): @docstring.dedent_interpd def annotate(self, s, xy, *args, **kwargs): + if kwargs.get('annotation_clip', None) is not False: + if 'clip_on' not in kwargs: + kwargs['clip_on'] = True + a = mtext.Annotation(s, xy, *args, **kwargs) a.set_transform(mtransforms.IdentityTransform()) if 'clip_on' in kwargs: