Re: [Matplotlib-users] Question about imshow

2009-05-18 Thread John Hunter
On Sun, May 17, 2009 at 11:07 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:

 I think one possible solution would be to simply deprecate the support
 for PIL image in imshow, and let users explicitly use array-interface
 via asarray function.

 Is there any other idea?
 I'll make this change unless someone come up with something.

I'm not wild about removing the PIL functionality entirely just to
remove an inconsistency.  Andrew wrote the PIL support -- perhaps he
can comment.

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question about imshow

2009-05-18 Thread Andrew Straw
John Hunter wrote:
 On Sun, May 17, 2009 at 11:07 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:
 
 I think one possible solution would be to simply deprecate the support
 for PIL image in imshow, and let users explicitly use array-interface
 via asarray function.

 Is there any other idea?
 I'll make this change unless someone come up with something.
 
 I'm not wild about removing the PIL functionality entirely just to
 remove an inconsistency.  Andrew wrote the PIL support -- perhaps he
 can comment.

I wouldn't remove PIL support in imshow immediately, either, but I think
deprecation should be OK. Since Image-numpy conversion is now happening
through the array interface, I don't think there's much call to support
PIL directly anymore. We should make the deprecation warning give the
appropriate hint (In the future, 'imshow(pil_image)' will not be
supported. Use 'imshow(np.array(pil_image))' instead. Note that you may
need an origin='upper' keyword argument for the latter case.)

-Andrew

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question about imshow

2009-05-17 Thread Jae-Joon Lee

 I think the point here is that

        img = Image('foo.png')
        imshow(img)

 and

        img = Image('foo.png')
        imshow(asarray(img))

 give different results, since matplotlib.image.pil_to_array functions
 differently from what PIL exposes in __array_interface__

 --
 Pauli Virtanen



I see. Thanks for clarifying this. And yes, I think this should be fixed.

Hmm, it seems that somehow pil_to_array tries to make the image
upside-down by itself.

x_str = im.tostring('raw',im.mode,0,-1)

However. I'm afraid that changing this behavior may not be ideal for
backward-compatibility.

I think one possible solution would be to simply deprecate the support
for PIL image in imshow, and let users explicitly use array-interface
via asarray function.

Is there any other idea?
I'll make this change unless someone come up with something.

-JJ

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Question about imshow

2009-05-16 Thread jorgesmbox-ml

Hi,
I want to read images and do some processing with them. While learning how to 
do this, i.e. opening images, displaying them, transforming them tu numpy 
arrays, etc., I came across a strange behaviour. If I open an image and use 
imshow() to display it, it comes upside down. See this thread in the numpy 
mailing list for more details: 
http://thread.gmane.org/gmane.comp.python.numeric.general/30148 . Someone on 
that list suggested to check here if this behavior was correct. Is it normal 
that the image appears upside down? If yes, can someone explain what's going on?

jorge



  

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question about imshow

2009-05-16 Thread Jae-Joon Lee
On Sat, May 16, 2009 at 6:58 PM,  jorgesmbox...@yahoo.es wrote:

 Hi,
 I want to read images and do some processing with them. While learning how to 
 do this, i.e. opening images, displaying them, transforming them tu numpy 
 arrays, etc., I came across a strange behaviour. If I open an image and use 
 imshow() to display it, it comes upside down. See this thread in the numpy 
 mailing list for more details: 
 http://thread.gmane.org/gmane.comp.python.numeric.general/30148 . Someone on 
 that list suggested to check here if this behavior was correct. Is it normal 
 that the image appears upside down? If yes, can someone explain what's going 
 on?

Note that the image may be upside down for you but may be correct for
others. The array itself does not know about the orientation of the
image and you have to explicitly specify this.

For imshow (and other similar commands), use the origin keyword. e.g.,

  imshow(a, origin=lower)

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow

-JJ



 jorge





 --
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables
 unlimited royalty-free distribution of the report engine
 for externally facing server and web deployment.
 http://p.sf.net/sfu/businessobjects
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Question about imshow and matshow

2007-03-15 Thread Pellegrini Eric
Hello everybody,

when using matplotlib, any plot I create is displayed separately from my 
Tkinter application. Is there a direct way to embed the plot created by 
matplotlib in a widget such as a canvas using something like create_image or 
something else ?

Currently, the only thing I managed to do is:
-create my plot with matshow
-save the figure using savefig (png)
-embed the png in a canvas using create_image

not very smart, isn't it ?

Thank you very much

best regards

Eric Pellegrini

-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses.-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Question about imshow and matshow

2007-03-15 Thread Antonino Ingargiola
On 3/15/07, Pellegrini Eric [EMAIL PROTECTED] wrote:
 Hello everybody,

 when using matplotlib, any plot I create is displayed separately from my
 Tkinter application. Is there a direct way to embed the plot created by
 matplotlib in a widget such as a canvas using something like create_image
 or something else ?

 Currently, the only thing I managed to do is:
 -create my plot with matshow
 -save the figure using savefig (png)
 -embed the png in a canvas using create_image

 not very smart, isn't it ?

Definitely not ;). It's simple to embed matplotlib in the common
toolkits. Download the examples tarball from the matplotlib site and
look at the files embedding_in_XXX.py. There are examples for tk, gtk,
qt and wx toolkits.

 Thank you very much

 best regards

 Eric Pellegrini

  ~ Antonio

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] question about imshow

2006-12-12 Thread John Travers
Hi, I'm struggling to get an array plotted the way I want with imshow.
I have an array A which i try to plot with

e=(tdims[0], tdims[-1], wldims[-1], wldims[0])
imshow(A,extent=e)

The image displays fine in the x axis, with tdims marked correctly,
but in the yaxis the dimensions are incorrect. And no combination of
extent and origin gives the correect display. To be more clear,
without extent set I get the array displayed the right way round, but
my problem is that my y axis should be *decreasing* as it goes up the
side of the image; if I set extent correctly, the image is scaled
right with respect to the y axis, but it is flipped so that the y axis
is increasing upwards. Is there a way to prevent this?

Many thanks for any help!
Ans thanks for an excellent plotting library!

Best regards
John

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about imshow

2006-12-12 Thread Pierre GM
On Tuesday 12 December 2006 06:57, John Travers wrote:
 Hi, I'm struggling to get an array plotted the way I want with imshow.
 I have an array A which i try to plot with

 e=(tdims[0], tdims[-1], wldims[-1], wldims[0])
 imshow(A,extent=e)

  if I set extent correctly, the image is scaled
 right with respect to the y axis, but it is flipped so that the y axis
 is increasing upwards. Is there a way to prevent this?

MMh. You can always play with the limits on the y axis:

gca().set_ylim(N.asarray(gca().get_ylim())[[-1,0]])

will invert (ymin, ymax) on the current axis (gca())

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about imshow

2006-12-12 Thread John Travers
On 12/12/06, Pierre GM [EMAIL PROTECTED] wrote:
 On Tuesday 12 December 2006 06:57, John Travers wrote:
  Hi, I'm struggling to get an array plotted the way I want with imshow.
  I have an array A which i try to plot with
 
  e=(tdims[0], tdims[-1], wldims[-1], wldims[0])
  imshow(A,extent=e)
 
   if I set extent correctly, the image is scaled
  right with respect to the y axis, but it is flipped so that the y axis
  is increasing upwards. Is there a way to prevent this?

 MMh. You can always play with the limits on the y axis:

 gca().set_ylim(N.asarray(gca().get_ylim())[[-1,0]])

 will invert (ymin, ymax) on the current axis (gca())


Thanks for your answers!
Pierre's method worked (I didn't try Scott's).
Cheers,
John

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about imshow

2006-12-12 Thread Eric Firing
This slightly modified excerpt from the new version of spy may do what 
you want:

nr, nc = Z.shape
extent = [-0.5, nc-0.5, nr-0.5, -0.5]
return self.imshow(Z, interpolation='nearest',
extent=extent, origin='upper')

Eric


John Travers wrote:
 Hi, I'm struggling to get an array plotted the way I want with imshow.
 I have an array A which i try to plot with
 
 e=(tdims[0], tdims[-1], wldims[-1], wldims[0])
 imshow(A,extent=e)
 
 The image displays fine in the x axis, with tdims marked correctly,
 but in the yaxis the dimensions are incorrect. And no combination of
 extent and origin gives the correect display. To be more clear,
 without extent set I get the array displayed the right way round, but
 my problem is that my y axis should be *decreasing* as it goes up the
 side of the image; if I set extent correctly, the image is scaled
 right with respect to the y axis, but it is flipped so that the y axis
 is increasing upwards. Is there a way to prevent this?
 
 Many thanks for any help!
 Ans thanks for an excellent plotting library!
 
 Best regards
 John
 
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users