Skip to content

Commit 79122a4

Browse files
authored
Merge pull request #7557 from efiring/scatter-no-expansion
API: disable the margin override except in classic mode
2 parents 56635c5 + 73640b5 commit 79122a4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,16 +4038,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
40384038
else:
40394039
collection.autoscale_None()
40404040

4041-
# The margin adjustment is a hack to deal with the fact that we don't
4042-
# want to transform all the symbols whose scales are in points
4043-
# to data coords to get the exact bounding box for efficiency
4044-
# reasons. It can be done right if this is deemed important.
4045-
# Also, only bother with this padding if there is anything to draw.
4046-
if self._xmargin < 0.05 and x.size > 0:
4047-
self.set_xmargin(0.05)
4048-
4049-
if self._ymargin < 0.05 and x.size > 0:
4050-
self.set_ymargin(0.05)
4041+
# Classic mode only:
4042+
# ensure there are margins to allow for the
4043+
# finite size of the symbols. In v2.x, margins
4044+
# are present by default, so we disable this
4045+
# scatter-specific override.
4046+
if rcParams['_internal.classic_mode']:
4047+
if self._xmargin < 0.05 and x.size > 0:
4048+
self.set_xmargin(0.05)
4049+
if self._ymargin < 0.05 and x.size > 0:
4050+
self.set_ymargin(0.05)
40514051

40524052
self.add_collection(collection)
40534053
self.autoscale_view()

0 commit comments

Comments
 (0)