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

Skip to content

Commit 683cede

Browse files
committed
For a Bbox image, the display width and height were computed incorrectly at draw time,
leading to an off-by-one-pixel situation.
1 parent 2bb91ce commit 683cede

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,8 @@ def make_image(self, renderer, magnification=1.0):
11201120
im.set_resample(self._resample)
11211121

11221122
l, b, r, t = self.get_window_extent(renderer).extents #bbox.extents
1123-
widthDisplay = (round(r) + 0.5) - (round(l) - 0.5)
1124-
heightDisplay = (round(t) + 0.5) - (round(b) - 0.5)
1123+
widthDisplay = round(r) - round(l)
1124+
heightDisplay = round(t) - round(b)
11251125
widthDisplay *= magnification
11261126
heightDisplay *= magnification
11271127

0 commit comments

Comments
 (0)