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

Skip to content

Commit 3b34400

Browse files
committed
commited jae joons 2nd patch; figimage still sems broken for origin=up
svn path=/trunk/matplotlib/; revision=6379
1 parent 1aec975 commit 3b34400

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

examples/pylab_examples/figimage_demo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
Z.shape = 100,100
1313
Z[:,50:] = 1.
1414

15-
im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet)
16-
im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet)
15+
im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='upper')
16+
im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='upper')
1717

18+
fig.savefig('figimage_demo.png')
19+
fig.savefig('figimage_demo.svg')
20+
fig.savefig('figimage_demo.pdf')
1821
plt.show()
1922

2023

lib/matplotlib/axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,9 +1537,9 @@ def draw(self, renderer=None, inframe=False):
15371537
for im in self.images if im.get_visible()]
15381538

15391539
#flip the images if their origin is "upper"
1540-
[im.flipud_out() for _im, (im,_,_) in zip(self.images, ims) \
1541-
if _im.origin=="upper"]
1542-
1540+
if self.images[0].origin=='upper':
1541+
im.flipud_out()
1542+
15431543
l, b, r, t = self.bbox.extents
15441544
width = mag*((round(r) + 0.5) - (round(l) - 0.5))
15451545
height = mag*((round(t) + 0.5) - (round(b) - 0.5))

lib/matplotlib/figure.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,11 +752,15 @@ def draw(self, renderer):
752752
mag = renderer.get_image_magnification()
753753
ims = [(im.make_image(mag), im.ox*mag, im.oy*mag)
754754
for im in self.images]
755+
756+
for _im, (im,_,_) in zip(self.images, ims):
757+
if _im.origin=="upper":
758+
im.flipud_out()
759+
760+
755761
im = _image.from_images(self.bbox.height * mag,
756762
self.bbox.width * mag,
757763
ims)
758-
if self.images[0].origin=='upper':
759-
im.flipud_out()
760764

761765
im.is_grayscale = False
762766
l, b, w, h = self.bbox.bounds

0 commit comments

Comments
 (0)