@@ -1238,18 +1238,24 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
12381238 colls .append (coll )
12391239
12401240 if len (positions ) > 0 :
1241- minpos = min (position .min () for position in positions )
1242- maxpos = max (position .max () for position in positions )
1243-
1244- minline = (lineoffsets - linelengths ).min ()
1245- maxline = (lineoffsets + linelengths ).max ()
1246-
1247- if colls [0 ].is_horizontal ():
1248- corners = (minpos , minline ), (maxpos , maxline )
1249- else :
1250- corners = (minline , minpos ), (maxline , maxpos )
1251- self .update_datalim (corners )
1252- self .autoscale_view ()
1241+ # try to get min/max
1242+ min_max = [(np .min (_p ), np .max (_p )) for _p in positions
1243+ if len (_p ) > 0 ]
1244+ # if we have any non-empty positions, try to autoscale
1245+ if len (min_max ) > 0 :
1246+ mins , maxes = zip (* min_max )
1247+ minpos = np .min (mins )
1248+ maxpos = np .max (maxes )
1249+
1250+ minline = (lineoffsets - linelengths ).min ()
1251+ maxline = (lineoffsets + linelengths ).max ()
1252+
1253+ if colls [0 ].is_horizontal ():
1254+ corners = (minpos , minline ), (maxpos , maxline )
1255+ else :
1256+ corners = (minline , minpos ), (maxline , maxpos )
1257+ self .update_datalim (corners )
1258+ self .autoscale_view ()
12531259
12541260 return colls
12551261
@@ -4670,6 +4676,9 @@ def pcolor(self, *args, **kwargs):
46704676 *alpha*: ``0 <= scalar <= 1`` or *None*
46714677 the alpha blending value
46724678
4679+ *snap*: bool
4680+ Whether to snap the mesh to pixel boundaries.
4681+
46734682 Return value is a :class:`matplotlib.collections.Collection`
46744683 instance.
46754684
@@ -4819,6 +4828,8 @@ def pcolor(self, *args, **kwargs):
48194828 ec .lower () == "none" ):
48204829 kwargs ['antialiaseds' ] = False
48214830
4831+ kwargs .setdefault ('snap' , False )
4832+
48224833 collection = mcoll .PolyCollection (verts , ** kwargs )
48234834
48244835 collection .set_alpha (alpha )
0 commit comments