From 73640b56335245887472df5607c2ab6e637df0a5 Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Fri, 2 Dec 2016 11:21:08 -1000 Subject: [PATCH] scatter: disable the margin override except in classic mode With margins by default in v2.x, removing this override makes for a simpler and more predictable API. --- lib/matplotlib/axes/_axes.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 7becdb4e8baa..700e1c5df1ab 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4043,16 +4043,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, else: collection.autoscale_None() - # The margin adjustment is a hack to deal with the fact that we don't - # want to transform all the symbols whose scales are in points - # to data coords to get the exact bounding box for efficiency - # reasons. It can be done right if this is deemed important. - # Also, only bother with this padding if there is anything to draw. - if self._xmargin < 0.05 and x.size > 0: - self.set_xmargin(0.05) - - if self._ymargin < 0.05 and x.size > 0: - self.set_ymargin(0.05) + # Classic mode only: + # ensure there are margins to allow for the + # finite size of the symbols. In v2.x, margins + # are present by default, so we disable this + # scatter-specific override. + if rcParams['_internal.classic_mode']: + if self._xmargin < 0.05 and x.size > 0: + self.set_xmargin(0.05) + if self._ymargin < 0.05 and x.size > 0: + self.set_ymargin(0.05) self.add_collection(collection) self.autoscale_view()