> Hey Jae Joon -- thanks for looking into this.  I don't have time to
> test this patch, but I wanted to mention that there is an analogous
> problem for figure image compositing -- see figimage_demo.py.  agg
> shows the correct behavior: the two images should be in the lower
> left, and the blue should be down for image origin=lower and the blue
> should be up for image origin=upper.  So if you are having success
> with the image compositing orientation problems on the various
> backends, you may want to see if your fixes apply to the figimage
> problems as well.
>

My original patch does not work for this case, because the figimage is
drawn by Figure.draw() not by Axes.draw() method.
I'm attaching a new patch where I applied the same correction to the
Figure.draw().
I tested GtkAgg, Gtk, GtkCairo, Pdf, Ps and they all worked fine.


-JJ
Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py	(revision 6377)
+++ lib/matplotlib/axes.py	(working copy)
@@ -1536,15 +1536,16 @@
             ims = [(im.make_image(mag),0,0)
                    for im in self.images if im.get_visible()]
 
-
+            #flip the images if their origin is "upper"
+            [im.flipud_out() for _im, (im,_,_) in zip(self.images, ims) \
+             if _im.origin=="upper"]
+            
             l, b, r, t = self.bbox.extents
             width = mag*((round(r) + 0.5) - (round(l) - 0.5))
             height = mag*((round(t) + 0.5) - (round(b) - 0.5))
             im = mimage.from_images(height,
                                     width,
                                     ims)
-            if self.images[0].origin=='upper':
-                im.flipud_out()
 
             im.is_grayscale = False
             l, b, w, h = self.bbox.bounds
Index: lib/matplotlib/figure.py
===================================================================
--- lib/matplotlib/figure.py	(revision 6377)
+++ lib/matplotlib/figure.py	(working copy)
@@ -752,11 +752,13 @@
             mag = renderer.get_image_magnification()
             ims = [(im.make_image(mag), im.ox*mag, im.oy*mag)
                    for im in self.images]
+
+            [im.flipud_out() for _im, (im,_,_) in zip(self.images, ims) \
+             if _im.origin=="upper"]
+
             im = _image.from_images(self.bbox.height * mag,
                                     self.bbox.width * mag,
                                     ims)
-            if self.images[0].origin=='upper':
-                im.flipud_out()
 
             im.is_grayscale = False
             l, b, w, h = self.bbox.bounds
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to