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

Skip to content

Commit 7c3f08e

Browse files
committed
Merge pull request #4913 from jrevans/issue12
FIX: cast to int in input to Agg restore_region Can get floats as input, cast to int
2 parents 19c5d01 + e45903c commit 7c3f08e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ def restore_region(self, region, bbox=None, xy=None):
357357
else:
358358
ox, oy = xy
359359

360-
self._renderer.restore_region(region, x1, y1, x2, y2, ox, oy)
360+
# The incoming data is float, but the _renderer type-checking wants
361+
# to see integers.
362+
self._renderer.restore_region(region, int(x1), int(y1),
363+
int(x2), int(y2), int(ox), int(oy))
361364

362365
else:
363366
self._renderer.restore_region(region)

0 commit comments

Comments
 (0)