8000 Fix stackplot test. · matplotlib/matplotlib@f39c3af · GitHub
[go: up one dir, main page]

Skip to content

Commit f39c3af

Browse files
committed
Fix stackplot test.
1 parent f8fc588 commit f39c3af

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/matplotlib/axes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,11 @@ def add_collection(self, collection, autolim=True):
14811481

14821482
if collection.get_clip_path() is None:
14831483
collection.set_clip_path(self.patch)
1484-
if autolim and collection._paths and len(collection._offsets):
1484+
1485+
if (autolim and
1486+
collection._paths is not None and
1487+
len(collection._paths) and
1488+
len(collection._offsets)):
14851489
self.update_datalim(collection.get_datalim(self.transData))
14861490

14871491
collection._remove_method = lambda h: self.collections.remove(h)

lib/matplotlib/collections.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Collection(artist.Artist, cm.ScalarMappable):
4949
* *cmap*: None (optional for
5050
:class:`matplotlib.cm.ScalarMappable`)
5151
* *hatch*: None
52-
* *zorder*: 1
52+
* *zorder*: 1
5353
5454
5555
*offsets* and *transOffset* are used to translate the patch after
@@ -111,11 +111,9 @@ def __init__(self,
111111
self.set_hatch(hatch)
112112
self.set_offset_position(offset_position)
113113
self.set_zorder(zorder)
114-
114+
115115
self._uniform_offsets = None
116-
self._offsets = np.array([], np.float_)
117-
# Force _offsets to be Nx2
118-
self._offsets.shape = (0, 2)
116+
self._offsets = np.array([[0, 0]], np.float_)
119117
if offsets is not None:
120118
offsets = np.asanyarray(offsets)
121119
offsets.shape = (-1, 2) # Make it Nx2

0 commit comments

Comments
 (0)
0