Re: [Matplotlib-users] Rounding issue when plotting

2007-04-24 Thread David Koch

Mhm,

thank you for testing - it doesn't work here unless I scale everthing. Bug?

Linux,

numpy.__version__

'1.0.1'

matplotlib.__version__

'0.87.3'
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] confusion about what part of numpy pylab imports

2007-04-24 Thread Mark Bakker

Hello list -

I am confused about the part of numpy that pylab imports.
Apparently, pylab imports 'zeros', but not the 'zeros' from numpy, as it
returns integers by default, rather than floats.
The same holds for 'ones' and 'empty'.
Example:

from pylab import *
zeros(3)

array([0, 0, 0])

from numpy import *
zeros(3)

array([ 0.,  0.,  0.])

Can this be fixed? Any explanation how this happens? Pylab just imports part
of numpy, doesn't it?

Thanks,

Mark
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Newbie. Memory useage question

2007-04-24 Thread Matthias Michler
Hi,

a friend gave me the little example I attached.
He uses 'gca().images = []' to delete the images. I'm not sure about memory 
usage of that method, but I think deleting images (using clf() or the above 
way) is quite important, because  otherwise one more image is drawn above the 
existing ones.

best regards,
Matthias

--
import pylab
import numpy

N = 100  # to generate a matrix
A = numpy.ones(N)[numpy.newaxis, :]*numpy.arange(N)[:, numpy.newaxis]/(N-1)

pylab.figure(0)
ax = pylab.subplot(111)
for item in pylab.cm.cmapnames[:3]: # plot some cmap examples
print  doing cm. + item
eval(pylab.imshow(A, cmap=pylab.cm.+item+, interpolation='nearest'))
pylab.savefig(item+'.png')
ax.images = [] # delete images
-

On Tuesday 24 April 2007 00:48, [EMAIL PROTECTED] wrote:
 I'm producing series of plots (spectograms) in a program loop using imshow
 and saving each plot to .png.  Even though I close() each plot after each
 savefig(...), the memory does not appear to be freed up, and the memory
 useage goes up and up as the program runs (and stalls the computer as it
 thrashes the page file).

 This is the essence of the code:

 for i in range(..):
 pylab.imshow(logPSDs[i]...)
 pylab.colorbar()
 pylab.savefig(plotName[i])
 pylab.close()

 Is there anything that I should be doing to stop this memory wastage?
 (The plots themselves are fantastic!)

 UNITED GROUP
 This email message is the property of United Group. The information in this
 email is confidential and may be legally privileged. It is intended solely
 for the addressee. Access to this email by anyone else is unauthorised. If
 you are not the intended recipient, you may not disclose, copy or
 distribute this email, nor take or omit to take any action in reliance on
 it. United Group accepts no liability for any damage caused by this email
 or any attachments due to viruses, interference, interception, corruption
 or unauthorised access. If you have received this email in error, please
 notify United Group immediately by email to the sender's email address and
 delete this document.

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pylab.setp - expected behaviour?

2007-04-24 Thread Jouni K . Seppänen
Matthias Michler [EMAIL PROTECTED] writes:

 The result really surprises me (using module time):
  time plot  9.7 sec
  time setp 9.9 sec- slower than plot!
  time .set  5.0 sec

 So my question is: Is this the expected / desired behaviour?

I think it is not surprising. The setp function (and much of the pylab
interface in general) is designed for convenience in interactive use,
and thus it handles various useful cases such as a list of objects as
the first argument, and different ways to specify properties (e.g.
setp(object, prop='value') and setp(object, 'prop', 'value')).
Eventually it does the equivalent of

  (getattr(object, 'set_%s'%prop))(value)

which is obviously much slower than the direct

  object.set_prop(value)

So, if you are writing a program, you are better off using the OO
interface.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] confusion about what part of numpy pylab imports

2007-04-24 Thread Gary Ruben
Hi Mark,
this thread may help:
http://thread.gmane.org/gmane.comp.python.numeric.general/13399/focus=13421

Essentially, pylab uses a compatibility layer to ease the task of 
supporting the three array packages - currently this uses the Numeric 
version of the ones and zeros functions giving the behaviour you observe 
- this will be fixed when pylab drops support for the older packages, 
which should be soon.

Gary R.

Mark Bakker wrote:
 Hello list -
 
 I am confused about the part of numpy that pylab imports.
 Apparently, pylab imports 'zeros', but not the 'zeros' from numpy, as it 
 returns integers by default, rather than floats.
 The same holds for 'ones' and 'empty'.
 Example:
   from pylab import *
   zeros(3)
 array([0, 0, 0])
   from numpy import *
   zeros(3)
 array([ 0.,  0.,  0.])
 
 Can this be fixed? Any explanation how this happens? Pylab just imports 
 part of numpy, doesn't it?
 
 Thanks,
 
 Mark


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Forcing full value on axis

2007-04-24 Thread Tommy Grav
I have a plot where the x axis ticks are given as

0.1  0.15  0.20  0.025  0.30  0.35

with +3.732e2 given in the lower right of the axis.
How can I force the ticks to have
373.3  373.35 

and so on?

Cheers
Tommy

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Newbie. Memory useage question

2007-04-24 Thread Eric Firing
[EMAIL PROTECTED] wrote:
 
 I'm producing series of plots (spectograms) in a program loop using 
 imshow and saving each plot to .png.  Even though I close() each plot 
 after each savefig(...), the memory does not appear to be freed up, and 
 the memory useage goes up and up as the program runs (and stalls the 
 computer as it thrashes the page file).
 
 This is the essence of the code:
 
 for i in range(..):
 pylab.imshow(logPSDs[i]...)
 pylab.colorbar()
 pylab.savefig(plotName[i])
 pylab.close()
 
 Is there anything that I should be doing to stop this memory wastage? 
  (The plots themselves are fantastic!)

There seem to be big memory leak problems with all interactive backends. 
  It looks like you don't need an interactive backend.  If this is the 
case, then instead of starting with import pylab, try:

import matplotlib
matplotlib.use('Agg')
import pylab

Eric

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Newbie. Memory useage question

2007-04-24 Thread John Hunter
On 4/23/07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 I'm producing series of plots (spectograms) in a program loop using imshow
 and saving each plot to .png.  Even though I close() each plot after each
 savefig(...), the memory does not appear to be freed up, and the memory
 useage goes up and up as the program runs (and stalls the computer as it
 thrashes the page file).

 This is the essence of the code:

 for i in range(..):
 pylab.imshow(logPSDs[i]...)
 pylab.colorbar()
 pylab.savefig(plotName[i])
 pylab.close()

The following code does not appear to leak:

import matplotlib
matplotlib.use('Agg')
from matplotlib.cbook import report_memory
import matplotlib.numerix as nx
import pylab


for i in range(100):
print i, report_memory(i)
fig = pylab.figure(1)
X = nx.mlab.rand(100,100)
pylab.imshow(X)
pylab.colorbar()
pylab.savefig('_test%d'%i)
pylab.close(1)


Are you running your program in a GUI?  Eric points out there are some
leaks in the GUI canvases which we have not succeeded in tracking
down.  If you only want image generation, you can use an image backend
w/o leaks.  The one thing to be careful of is to make sure you are not
overplotting multiple images onto the same Axes, eg by clearing the
figure or axes if you are reusing it.

JDH





 Is there anything that I should be doing to stop this memory wastage?
 (The plots themselves are fantastic!)
  UNITED GROUP
  This email message is the property of United Group. The information in this
 email is confidential and may be legally privileged. It is intended solely
 for the addressee. Access to this email by anyone else is unauthorised. If
 you are not the intended recipient, you may not disclose, copy or distribute
 this email, nor take or omit to take any action in reliance on it. United
 Group accepts no liability for any damage caused by this email or any
 attachments due to viruses, interference, interception, corruption or
 unauthorised access.
  If you have received this email in error, please notify United Group
 immediately by email to the sender's email address and delete this document.

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Forcing full value on axis

2007-04-24 Thread John Hunter
On 4/24/07, Tommy Grav [EMAIL PROTECTED] wrote:
 I have a plot where the x axis ticks are given as

 0.1  0.15  0.20  0.025  0.30  0.35

 with +3.732e2 given in the lower right of the axis.
 How can I force the ticks to have
 373.3  373.35 


It always helps if you give us complete examples that we can run --
then we can give you back tested answers we know work.  You should be
able to tweak the axes.formatter.limits rc param.  Something like

import matplotlib
matplotlib.rcParams['axes.formatter.limits'] = -15,15

before you make your plots.

If this doesn't work, please post a complete example.

Darren, for the range he is using according to his post, I wouldn't
expect the exponential formatting to be kicking in since log10(.4) =
-.4 which is within the default range.

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] confusion about what part of numpy pylab imports

2007-04-24 Thread Eric Firing
Gary Ruben wrote:
 Hi Mark,
 this thread may help:
 http://thread.gmane.org/gmane.comp.python.numeric.general/13399/focus=13421
 
 Essentially, pylab uses a compatibility layer to ease the task of 
 supporting the three array packages - currently this uses the Numeric 
 version of the ones and zeros functions giving the behaviour you observe 
 - this will be fixed when pylab drops support for the older packages, 
 which should be soon.

What we will do is drop the use of numerix internally, but the numerix 
module will almost certainly remain, presumably with the Numeric and 
numarray support removed; so numerix will still use numpy's own 
oldnumeric compatibility layer, and I expect pylab will still import 
from it--at least, by default.  The intention is to avoid breaking 
things unnecessarily.  I can imagine possible variations, such as using 
an rc param to tell pylab whether to import from plain numpy or from 
oldnumeric, and splitting pylab into core pylab functions (figure, show, 
etc.) versus the convenience all-in-one namespace (mostly from numpy); 
but we will take one step at a time.

Eric

 
 Gary R.
 
 Mark Bakker wrote:
 Hello list -

 I am confused about the part of numpy that pylab imports.
 Apparently, pylab imports 'zeros', but not the 'zeros' from numpy, as it 
 returns integers by default, rather than floats.
 The same holds for 'ones' and 'empty'.
 Example:
   from pylab import *
   zeros(3)
 array([0, 0, 0])
   from numpy import *
   zeros(3)
 array([ 0.,  0.,  0.])

 Can this be fixed? Any explanation how this happens? Pylab just imports 
 part of numpy, doesn't it?

 Thanks,

 Mark
 
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animating contours

2007-04-24 Thread Yoav Avitzour






OK, thanks for the
info. Is imshow currently the only array imaging routine that supports
this functionality?


Thanks again,
Yoav



Eric Firing wrote:

The
contour routine does not have update functionality similar to that of
an image; you have no choice but to generate a new ContourSet object
each time.
  
  
Eric
  
  
Yoav Avitzour wrote:
  
  Hi,



I'm trying to create 2D animations using contours. Is there a
recommended way to do this? I was hoping to follow the same route as in
the dynamic_image_gtkagg.py example, but for some reason set_array
doesn't work for me with contour. It doesn't produce any error, but the
figure just doesn't get updated after calling canvas.draw().



Matplotlib version: 0.87.7



Thanks,


Yoav






-

This SF.net email is sponsored by DB2 Express

Download DB2 Express C - the FREE version of DB2 express and take

control of your XML. No limits. Just data. Click to get it now.

http://sourceforge.net/powerbar/db2/






___

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

  




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [Fwd: Re: animating contours]

2007-04-24 Thread Eric Firing

(forgot reply-to-all)
---BeginMessage---

Yoav Avitzour wrote:


OK, thanks for the info. Is imshow currently the only array imaging 
routine that supports this functionality?


You can also do it with pcolor, provided you flatten the array.  This 
was probably true with 0.87.7; I have verified it only with svn.


Eric



Thanks again,

Yoav


Eric Firing wrote:

The contour routine does not have update functionality similar to that 
of an image; you have no choice but to generate a new ContourSet 
object each time.


Eric

Yoav Avitzour wrote:

Hi,


I'm trying to create 2D animations using contours. Is there a 
recommended way to do this? I was hoping to follow the same route as 
in the dynamic_image_gtkagg.py example, but for some reason set_array 
doesn't work for me with contour. It doesn't produce any error, but 
the figure just doesn't get updated after calling canvas.draw().



Matplotlib version: 0.87.7


Thanks,

Yoav




- 


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/




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



---End Message---
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users