[Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import

2010-05-31 Thread Craig McQueen
I just installed matplotlib-0.99.3.win32-py2.6.exe on this Win2000 PC. 
When I try:

   from matplotlib import pyplot as plt

it crashes Python with an apparent NULL-pointer reference. If I run
   python -v

then it crashes just after:
# c:\python26\lib\site-packages\matplotlib\transforms.pyc matches 
c:\python26\li

b\site-packages\matplotlib\transforms.py
import matplotlib.transforms # precompiled from 
c:\python26\lib\site-packages\ma

tplotlib\transforms.pyc

matplotlib-0.99.1.win32-py2.6.exe worked fine on this PC.

Regards,
Craig McQueen


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import

2010-05-31 Thread Christoph Gohlke


On 5/31/2010 1:53 AM, Craig McQueen wrote:
   I just installed matplotlib-0.99.3.win32-py2.6.exe on this Win2000 PC.
 When I try:
  from matplotlib import pyplot as plt

 it crashes Python with an apparent NULL-pointer reference. If I run
  python -v

 then it crashes just after:
 # c:\python26\lib\site-packages\matplotlib\transforms.pyc matches
 c:\python26\li
 b\site-packages\matplotlib\transforms.py
 import matplotlib.transforms # precompiled from
 c:\python26\lib\site-packages\ma
 tplotlib\transforms.pyc

 matplotlib-0.99.1.win32-py2.6.exe worked fine on this PC.

 Regards,
 Craig McQueen


I can not reproduce the crash in a Virtual Machine with Windows 2000 
SP4, Python 2.6.5, numpy 1.4.1, and matplotlib 0.99.3.

Exactly which versions are you using, and how did you install Python 
(for all users?). What is your CPU?

matplotlib-0.99.3.win32-py2.6 was built against numpy 1.4.1, libpng 
1.4.2 and zlib 1.2.5, while matplotlib-0.99.1.win32-py2.6 was built 
against numpy 1.3.0, libpng 1.2.3x, and zlib 1.2.3.

Christoph

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Oz Nahum
Hi Guys,

I'm breaking my head how to use scientific numbering on color bar:

I use the following code to plot data from multiple files, would be great if
someone could direct me, becuase the numbers I have are 0.0013 et. and what
ever I do, the number just go over each other:


for i in xrange(len(data)):
x,z,som=data[i][x],data[i][z],data[i]['ch2o']
som=som*MwSOM
som=som*1000
x=N.unique(x)
z=N.unique(z)
p_w=N.unique(som)
fig = plt.figure(len(data)+1+i)
ax1 = fig.add_subplot(111)
som=resize(som,(z.size,x.size))
v=N.arange(1.15,1.18,0.002)
CS=contourf(x,z,som,cmap=cm.pink_r)
cb=colorbar(CS, orientation='horizontal', shrink=1.0,aspect=33)
ax1.set_title(SOM +titles[i])
savefig('Fig'+str(i)+'.png')


Thanks in advance !

-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import

2010-05-31 Thread Craig McQueen
Christoph Gohlke wrote:

 On 5/31/2010 1:53 AM, Craig McQueen wrote:
   I just installed matplotlib-0.99.3.win32-py2.6.exe on this Win2000 PC.
 When I try:
  from matplotlib import pyplot as plt

 it crashes Python with an apparent NULL-pointer reference. If I run
  python -v

 then it crashes just after:
 # c:\python26\lib\site-packages\matplotlib\transforms.pyc matches
 c:\python26\li
 b\site-packages\matplotlib\transforms.py
 import matplotlib.transforms # precompiled from
 c:\python26\lib\site-packages\ma
 tplotlib\transforms.pyc

 matplotlib-0.99.1.win32-py2.6.exe worked fine on this PC.

 Regards,
 Craig McQueen


 I can not reproduce the crash in a Virtual Machine with Windows 2000 
 SP4, Python 2.6.5, numpy 1.4.1, and matplotlib 0.99.3.

 Exactly which versions are you using, and how did you install Python 
 (for all users?). What is your CPU?

 matplotlib-0.99.3.win32-py2.6 was built against numpy 1.4.1, libpng 
 1.4.2 and zlib 1.2.5, while matplotlib-0.99.1.win32-py2.6 was built 
 against numpy 1.3.0, libpng 1.2.3x, and zlib 1.2.3.

 Christoph


Ah--installing numpy 1.4.1 fixed the issue. I had numpy 1.3.0 installed 
before that.

Thanks for such a helpful response. I wasn't aware that matplotlib is 
built against a particular version of numpy (not quite sure what that 
means either, unless numpy provides a direct C API as well as the Python 
API; please excuse my ignorance).

(To answer your questions in case that's still useful somehow... I'm 
using Windows 2000 SP4, Python 2.6.5, on a Pentium 4 PC. I installed 
Python for all users.)

Thanks and regards,
Craig McQueen


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Oz Nahum
Hi,

I wanted to be more clear:

the numbers on my figure's color bar range from 0 to 1.7,
but mpl writes the following numbers:

0., 0.000250,0.50,0.000750,

etc.

This is totally not somthing I can use, it looks horrible.
I'm also attaching the image ...



--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
attachment: Fig0.png--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Oz Nahum
found a solution after 2 hours ...

colorbar(ax=ax1,  orientation='horizontal',format='%.3f')

now, I need to know how to set up limits for all the images which are
exactly the same limits.
So far I'm failing with the use of boundaries



Would be happy to know

-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Benjamin Root
Oz,

Some plotting functions like pcolor and imshow have keyword args for
vmin/vmax where you can explicitly set the min and maximum values for the
colorscale.  There are some more complicated things you can do with the
colormap that are more generic to all plotting functions as well, but I
would see if using vmin and vmax does the trick for you.

Ben Root

On Mon, May 31, 2010 at 7:25 PM, Oz Nahum nahu...@gmail.com wrote:

 found a solution after 2 hours ...

 colorbar(ax=ax1,  orientation='horizontal',format='%.3f')

 now, I need to know how to set up limits for all the images which are
 exactly the same limits.
 So far I'm failing with the use of boundaries

 

 Would be happy to know

 --
 Oz Nahum
 Graduate Student
 Zentrum für Angewandte Geologie
 Universität Tübingen

 ---

 Imagine there's no countries
 it isn't hard to do
 Nothing to kill or die for
 And no religion too
 Imagine all the people
 Living life in peace


 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Oz Nahum
Hi Thanks for the answer,

actually, I always use
show and plot, I have no clue how to use the functions you suggested ...

I'll look into it.

Do you have an idea where I can find a description of the keyword format

'%.3f' is nice, but still not scientific format...

is this like Fortran?

On Mon, May 31, 2010 at 5:41 PM, Benjamin Root ben.r...@ou.edu wrote:

 Oz,

 Some plotting functions like pcolor and imshow have keyword args for
 vmin/vmax where you can explicitly set the min and maximum values for the
 colorscale.  There are some more complicated things you can do with the
 colormap that are more generic to all plotting functions as well, but I
 would see if using vmin and vmax does the trick for you.

 Ben Root

 On Mon, May 31, 2010 at 7:25 PM, Oz Nahum nahu...@gmail.com wrote:

 found a solution after 2 hours ...

 colorbar(ax=ax1,  orientation='horizontal',format='%.3f')

 now, I need to know how to set up limits for all the images which are
 exactly the same limits.
 So far I'm failing with the use of boundaries

 

 Would be happy to know

 --
 Oz Nahum
 Graduate Student
 Zentrum für Angewandte Geologie
 Universität Tübingen

 ---

 Imagine there's no countries
 it isn't hard to do
 Nothing to kill or die for
 And no religion too
 Imagine all the people
 Living life in peace


 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Andre Walker-Loud

Hi Thanks for the answer,

actually, I always use
show and plot, I have no clue how to use the functions you  
suggested ...


I'll look into it.

Do you have an idea where I can find a description of the keyword  
format


'%.3f' is nice, but still not scientific format...


you can use

'%.3e'

for scientific format.


Cheers,

Andre





is this like Fortran?

On Mon, May 31, 2010 at 5:41 PM, Benjamin Root ben.r...@ou.edu  
wrote:

Oz,

Some plotting functions like pcolor and imshow have keyword args for  
vmin/vmax where you can explicitly set the min and maximum values  
for the colorscale.  There are some more complicated things you can  
do with the colormap that are more generic to all plotting functions  
as well, but I would see if using vmin and vmax does the trick for  
you.


Ben Root

On Mon, May 31, 2010 at 7:25 PM, Oz Nahum nahu...@gmail.com wrote:
found a solution after 2 hours ...

colorbar(ax=ax1,  orientation='horizontal',format='%.3f')

now, I need to know how to set up limits for all the images which are
exactly the same limits.
So far I'm failing with the use of boundaries



Would be happy to know

--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import

2010-05-31 Thread Christoph Gohlke


On 5/31/2010 4:53 PM, Craig McQueen wrote:
 Christoph Gohlke wrote:

 On 5/31/2010 1:53 AM, Craig McQueen wrote:
 I just installed matplotlib-0.99.3.win32-py2.6.exe on this Win2000 PC.
 When I try:
 from matplotlib import pyplot as plt

 it crashes Python with an apparent NULL-pointer reference. If I run
 python -v

 then it crashes just after:
 # c:\python26\lib\site-packages\matplotlib\transforms.pyc matches
 c:\python26\li
 b\site-packages\matplotlib\transforms.py
 import matplotlib.transforms # precompiled from
 c:\python26\lib\site-packages\ma
 tplotlib\transforms.pyc

 matplotlib-0.99.1.win32-py2.6.exe worked fine on this PC.

 Regards,
 Craig McQueen


 I can not reproduce the crash in a Virtual Machine with Windows 2000
 SP4, Python 2.6.5, numpy 1.4.1, and matplotlib 0.99.3.

 Exactly which versions are you using, and how did you install Python
 (for all users?). What is your CPU?

 matplotlib-0.99.3.win32-py2.6 was built against numpy 1.4.1, libpng
 1.4.2 and zlib 1.2.5, while matplotlib-0.99.1.win32-py2.6 was built
 against numpy 1.3.0, libpng 1.2.3x, and zlib 1.2.3.

 Christoph


 Ah--installing numpy 1.4.1 fixed the issue. I had numpy 1.3.0 installed
 before that.

 Thanks for such a helpful response. I wasn't aware that matplotlib is
 built against a particular version of numpy (not quite sure what that
 means either, unless numpy provides a direct C API as well as the Python
 API; please excuse my ignorance).

 (To answer your questions in case that's still useful somehow... I'm
 using Windows 2000 SP4, Python 2.6.5, on a Pentium 4 PC. I installed
 Python for all users.)

 Thanks and regards,
 Craig McQueen


Yes, numpy has a C API, which is used by MPL.

I can confirm the crashes with numpy 1.3.

John: I rebuilt the 32 bit binaries for Python 2.5 and 2.6 against numpy 
1.3.0. They do also work with numpy 1.4.1. Please consider uploading 
these binaries to the SF site. I also noticced that the eggs on the SF 
download site are corrupted, showing only 1.6 KB. The updated files are 
at http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib. Thanks.

--
Christoph




--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Oz Nahum
hi andre,
thanks for your reply,

do you know where I can find more documentation about this ?

Thanks,



On Mon, May 31, 2010 at 5:55 PM, Andre Walker-Loud walksl...@gmail.comwrote:

 Hi Thanks for the answer,

 actually, I always use
 show and plot, I have no clue how to use the functions you suggested ...

 I'll look into it.

 Do you have an idea where I can find a description of the keyword format

 '%.3f' is nice, but still not scientific format...


 you can use

 '%.3e'

 for scientific format.


 Cheers,

 Andre




 is this like Fortran?

 On Mon, May 31, 2010 at 5:41 PM, Benjamin Root ben.r...@ou.edu wrote:

 Oz,

 Some plotting functions like pcolor and imshow have keyword args for
 vmin/vmax where you can explicitly set the min and maximum values for the
 colorscale.  There are some more complicated things you can do with the
 colormap that are more generic to all plotting functions as well, but I
 would see if using vmin and vmax does the trick for you.

 Ben Root

 On Mon, May 31, 2010 at 7:25 PM, Oz Nahum nahu...@gmail.com wrote:

 found a solution after 2 hours ...

 colorbar(ax=ax1,  orientation='horizontal',format='%.3f')

 now, I need to know how to set up limits for all the images which are
 exactly the same limits.
 So far I'm failing with the use of boundaries

 

 Would be happy to know

 --
 Oz Nahum
 Graduate Student
 Zentrum für Angewandte Geologie
 Universität Tübingen

 ---

 Imagine there's no countries
 it isn't hard to do
 Nothing to kill or die for
 And no religion too
 Imagine all the people
 Living life in peace


 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





 --
 Oz Nahum
 Graduate Student
 Zentrum für Angewandte Geologie
 Universität Tübingen

 ---

 Imagine there's no countries
 it isn't hard to do
 Nothing to kill or die for
 And no religion too
 Imagine all the people
 Living life in peace


 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Andre Walker-Loud

Hi Oz,

Sorry, I am not familiar with what you are trying to do with your  
plots.  Everything I have learned is from trial and error, the gallery  
page


http://matplotlib.sourceforge.net/gallery.html

and the user manual

http://matplotlib.sourceforge.net/contents.html


Good luck,

Andre





On May 31, 2010, at 8:56 PM, Oz Nahum wrote:


hi andre,
thanks for your reply,

do you know where I can find more documentation about this ?

Thanks,



On Mon, May 31, 2010 at 5:55 PM, Andre Walker-Loud walksl...@gmail.com 
 wrote:

Hi Thanks for the answer,

actually, I always use
show and plot, I have no clue how to use the functions you  
suggested ...


I'll look into it.

Do you have an idea where I can find a description of the keyword  
format


'%.3f' is nice, but still not scientific format...


you can use

'%.3e'

for scientific format.


Cheers,

Andre





is this like Fortran?

On Mon, May 31, 2010 at 5:41 PM, Benjamin Root ben.r...@ou.edu  
wrote:

Oz,

Some plotting functions like pcolor and imshow have keyword args  
for vmin/vmax where you can explicitly set the min and maximum  
values for the colorscale.  There are some more complicated things  
you can do with the colormap that are more generic to all plotting  
functions as well, but I would see if using vmin and vmax does the  
trick for you.


Ben Root

On Mon, May 31, 2010 at 7:25 PM, Oz Nahum nahu...@gmail.com wrote:
found a solution after 2 hours ...

colorbar(ax=ax1,  orientation='horizontal',format='%.3f')

now, I need to know how to set up limits for all the images which are
exactly the same limits.
So far I'm failing with the use of boundaries



Would be happy to know

--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users





--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace




--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] accessing colorbar() list of values

2010-05-31 Thread Oz Nahum
Hi,

I open another thread because I think this is not related.

I have figured out how to create scientific notation in the color bar.
However, by default Python creates really ugly values for printing:
1.165E+00, 1.167E+00... etc.

I figure that they are stored somewhere in a list.

I could do :

cb=colorbar(ax=ax1, orientation='horizontal',format='%.e')

and then with:
cb.ax.get_xmajorticklabels

i get:

bound method Axes.get_xmajorticklabels of matplotlib.axes.Axes object at
0x5716210

But do I actually modify this list I have no clue...

Would be happy to know if somebody knows



-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] accessing colorbar() list of values

2010-05-31 Thread Benjamin Root
Yeah, I don't think that is what you want.  I believe the 'ax' you are
referencing there is the figure axes.  How do you want the numbers to
appear?

Ben Root

On Mon, May 31, 2010 at 8:27 PM, Oz Nahum nahu...@gmail.com wrote:

 Hi,

 I open another thread because I think this is not related.

 I have figured out how to create scientific notation in the color bar.
 However, by default Python creates really ugly values for printing:
 1.165E+00, 1.167E+00... etc.

 I figure that they are stored somewhere in a list.

 I could do :

 cb=colorbar(ax=ax1, orientation='horizontal',format='%.e')

 and then with:
 cb.ax.get_xmajorticklabels

 i get:

 bound method Axes.get_xmajorticklabels of matplotlib.axes.Axes object at
 0x5716210

 But do I actually modify this list I have no clue...

 Would be happy to know if somebody knows



 --
 Oz Nahum
 Graduate Student
 Zentrum für Angewandte Geologie
 Universität Tübingen

 ---

 Imagine there's no countries
 it isn't hard to do
 Nothing to kill or die for
 And no religion too
 Imagine all the people
 Living life in peace




 --


 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting scientific number notation on colorbar

2010-05-31 Thread Benjamin Root
On Mon, May 31, 2010 at 7:51 PM, Oz Nahum nahu...@gmail.com wrote:

 Hi Thanks for the answer,

 actually, I always use
 show and plot, I have no clue how to use the functions you suggested ...

 I'll look into it.

 Do you have an idea where I can find a description of the keyword format

 '%.3f' is nice, but still not scientific format...

 is this like Fortran?


I believe so (I am not too familiar with fortran, but the ideas are similar
in many languages like C's sprintf.  You can do '%.3g' to pretty print the
float numbers (in a sense), and '%.3e' to always do scientific notation.

Ben Root
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] imshow, imsave to PIL image conversion

2010-05-31 Thread rugspin

I have a small problem how to convert an image from matplotlib to PIL

right now doing somthing like this:
--
from scipy import *
from pylab import *
from PIL import Image

a = arange(16384).reshape(128,128)
imsave( test.png, a, cmap=cm.summer,vmin=0,vmax=16383)
b = Image.open(test.png )
--

so I have a 128x128 array, get a 128x128 size png by making use of a
colormap and get a 128x128 size PIL image. But so far I could figure out a
way to do this directly without writing a temporary png and reading it
again, which is quite slow. My important point here is to keep the the pixel
resolution.
I would be glad about some help

Regards Hans
-- 
View this message in context: 
http://old.nabble.com/imshow%2C-imsave-to-PIL-image-conversion-tp28736246p28736246.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import

2010-05-31 Thread John Hunter
On Mon, May 31, 2010 at 7:56 PM, Christoph Gohlke cgoh...@uci.edu wrote:

 John: I rebuilt the 32 bit binaries for Python 2.5 and 2.6 against numpy
 1.3.0. They do also work with numpy 1.4.1. Please consider uploading these
 binaries to the SF site. I also noticced that the eggs on the SF download
 site are corrupted, showing only 1.6 KB. The updated files are at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib. Thanks.

Hey Christoph -- I just updated the win32 binaries again.  Thanks for
the rebuild.  The sf upload page is extremely fragile and flaky, so
I'm not surprised a corrupted binary got uploaded.  I made sure the
uploads completed this time -- hopefully they are now good but take a
look.

JDH

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib 0.99.3 win32 py2.6 crashes on import

2010-05-31 Thread Christoph Gohlke


On 5/31/2010 7:45 PM, John Hunter wrote:
 On Mon, May 31, 2010 at 7:56 PM, Christoph Gohlkecgoh...@uci.edu  wrote:

 John: I rebuilt the 32 bit binaries for Python 2.5 and 2.6 against numpy
 1.3.0. They do also work with numpy 1.4.1. Please consider uploading these
 binaries to the SF site. I also noticced that the eggs on the SF download
 site are corrupted, showing only 1.6 KB. The updated files are at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib. Thanks.

 Hey Christoph -- I just updated the win32 binaries again.  Thanks for
 the rebuild.  The sf upload page is extremely fragile and flaky, so
 I'm not surprised a corrupted binary got uploaded.  I made sure the
 uploads completed this time -- hopefully they are now good but take a
 look.



looks good to me.

--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow, imsave to PIL image conversion

2010-05-31 Thread Angus McMorland
On 31 May 2010 19:49, rugspin piet_par...@web.de wrote:


 I have a small problem how to convert an image from matplotlib to PIL

 right now doing somthing like this:
 --
 from scipy import *
 from pylab import *
 from PIL import Image

 a = arange(16384).reshape(128,128)
 imsave( test.png, a, cmap=cm.summer,vmin=0,vmax=16383)
 b = Image.open(test.png )
 --


The Image.fromarray function should do what you want. For example,

import numpy as np   # note: use of from foo import *
import Image # is discouraged where possible

a = np.arange(128)[None,:] * np.ones(128)[:,None]
b = Image.fromarray(a)
c = np.asarray(b)
np.all(c == a)
  - True

I hope that helps,

Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow, imsave to PIL image conversion

2010-05-31 Thread Angus McMorland
On 31 May 2010 23:17, Angus McMorland amcm...@gmail.com wrote:

 On 31 May 2010 19:49, rugspin piet_par...@web.de wrote:


 I have a small problem how to convert an image from matplotlib to PIL

 right now doing somthing like this:
 --
 from scipy import *
 from pylab import *
 from PIL import Image

 a = arange(16384).reshape(128,128)
 imsave( test.png, a, cmap=cm.summer,vmin=0,vmax=16383)
 b = Image.open(test.png )
 --


 The Image.fromarray function should do what you want. For example,

 import numpy as np   # note: use of from foo import *
 import Image # is discouraged where possible

 a = np.arange(128)[None,:] * np.ones(128)[:,None]


Sorry - I was playing around with a few iterations of this line, and didn't
provide the most useful one. Your example:

a = np.arange(128**2).reshape(128,128)

should also work fine.


 b = Image.fromarray(a)
 c = np.asarray(b)
 np.all(c == a)
   - True

 I hope that helps,

 Angus.


-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users