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

Skip to content

Commit d08eb51

Browse files
committed
reverted a bug I introduced when toying around with copy region in agg
svn path=/trunk/matplotlib/; revision=6424
1 parent 630019a commit d08eb51

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

examples/event_handling/path_editor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import matplotlib
2+
matplotlib.use('TkAgg')
13
import numpy as np
24
import matplotlib.path as mpath
35
import matplotlib.patches as mpatches

lib/matplotlib/collections.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,9 @@ def fill_between_masked(x, y, mask, yboundary=0, **kwargs):
701701
theseverts = []
702702
xslice = x[ind0:ind1]
703703
yslice = y[ind0:ind1]
704+
if not len(xslice):
705+
continue
706+
704707
N = len(xslice)
705708
X = np.zeros((2*N+2, 2), np.float)
706709
X[0] = xslice[0], yboundary
@@ -750,6 +753,8 @@ def span_masked(x, mask, ymin, ymax, **kwargs):
750753
xranges = []
751754
for ind0, ind1 in mlab.contiguous_regions(mask):
752755
xslice = x[ind0:ind1]
756+
if not len(xslice):
757+
continue
753758
xranges.append((xslice[0], xslice[-1]-xslice[0]))
754759

755760
collection = BrokenBarHCollection(xranges, [ymin, ymax-ymin], **kwargs)

src/_backend_agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ RendererAgg::copy_from_bbox(const Py::Tuple& args) {
386386
throw Py::TypeError("Invalid bbox provided to copy_from_bbox");
387387

388388
// std::cout << l << " " << b << " " << r << " " << t << " " << (height - (int)b) << " " << height - (int)t << std::endl;
389-
agg::rect_i rect((int)l, height - (int)b, (int)r, height - (int)t);
389+
agg::rect_i rect((int)l, height - (int)t, (int)r, height - (int)b);
390390

391391
BufferRegion* reg = NULL;
392392
try {

0 commit comments

Comments
 (0)