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

Skip to content

Commit 18d25f9

Browse files
committed
Correctly set the initial data limit bounding box to null limits rather than the unit bounding box.
1 parent 33faad1 commit 18d25f9

File tree

7 files changed

+62
-469
lines changed

7 files changed

+62
-469
lines changed

lib/matplotlib/axes.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def set_figure(self, fig):
522522
self.bbox = mtransforms.TransformedBbox(self._position,
523523
fig.transFigure)
524524
# these will be updated later as data is added
525-
self.dataLim = mtransforms.Bbox.unit()
525+
self.dataLim = mtransforms.Bbox.null()
526526
self.viewLim = mtransforms.Bbox.unit()
527527
self.transScale = mtransforms.TransformWrapper(
528528
mtransforms.IdentityTransform())
@@ -1625,13 +1625,16 @@ def relim(self):
16251625
# Collections are deliberately not supported (yet); see
16261626
# the TODO note in artists.py.
16271627
self.dataLim.ignore(True)
1628+
self.dataLim.set_points(mtransforms.Bbox.null().get_points())
16281629
self.ignore_existing_data_limits = True
1630+
16291631
for line in self.lines:
16301632
self._update_line_limits(line)
16311633

16321634
for p in self.patches:
16331635
self._update_patch_limits(p)
16341636

1637+
16351638
def update_datalim(self, xys, updatex=True, updatey=True):
16361639
"""
16371640
Update the data lim bbox with seq of xy tups or equiv. 2-D array
@@ -8467,11 +8470,11 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84678470
for x, y, c in reversed(zip(xvals, yvals, color)):
84688471
if fill:
84698472
patches.append(self.fill(x, y,
8470-
closed=False,
8473+
closed=True,
84718474
facecolor=c))
84728475
else:
84738476
patches.append(self.fill(x, y,
8474-
closed=False, edgecolor=c,
8477+
closed=True, edgecolor=c,
84758478
fill=False))
84768479

84778480
# we return patches, so put it back in the expected order
@@ -8531,6 +8534,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
85318534

85328535
self.set_autoscalex_on(_saved_autoscalex)
85338536
self.set_autoscaley_on(_saved_autoscaley)
8537+
self.relim()
85348538
self.autoscale_view()
85358539

85368540
if nx == 1:
Binary file not shown.
Loading

0 commit comments

Comments
 (0)