[Matplotlib-users] matplotlib.lines.Line2D object at 0x283d310 - strange error

2009-05-27 Thread ninjasmith

Hi,

I'm a bit new to matplotlib and python.  I'm running ubuntu 64bit.  whenever
I try and do anything with matplotlib I get an error similar to above.  it
still works, i.e. when I run the show() command the plot will appear but all
matplotplib commands return an error similar to above. for example

In [15]: plot(a)
Out[15]: [matplotlib.lines.Line2D object at 0x28487d0]

In [16]: figure(2)
Out[16]: matplotlib.figure.Figure object at 0x2ddc150

Interestingly when I run from SPE and choose 'execute in shell' I get the
following errors. 
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/home.png': file does not exist.
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/back.png': file does not exist.
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/move.png': file does not exist.
11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/zoom_to_rect.png': file does not exist.

my simple script is as follows

import numpy, scipy, wave, struct
from pylab import *
from scipy import *
import wavFunctions
print(dir(wavFunctions))
#def readwave(wavfilename):

readwave=wavFunctions.readwave

#   w=wave.open(wavfilename,'rb')
#   (nchannel, width, rate, length, comptype, compname) = w.getparams()
#   frames = w.readframes(length)
#   data = numpy.array(struct.unpack(%sh %length*nchannel,
frames)).reshape(length,nchannel)
#   return data


audio = readwave(/media/LACIE/bfd
rendered/edited_single_hits/ayotte_snare_keplinger_hit.wav)
print audio
print audio.size
plot(audio)



fft_audio=fft(audio)
print fft_audio
figure(2)
plot(abs(fft_audio))
show()


11:32:29: Can't load image from file
'/usr/share/spe/_spe/skins/default/subplots.png': file does not exist.




-- 
View this message in context: 
http://www.nabble.com/matplotlib.lines.Line2D-object-at-0x283d310---strange-error-tp23740597p23740597.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Printing in wx

2009-05-27 Thread Stefanie Lück
Hi!

I'm trying to print my plots in a wxScrolledPanel under Windows XP but it 
dosen't work. I only can print / preview the start of the plot on the left 
upper site, the rest of page is empty:

http://www.snowflake-sl.info/printing_in_wx.JPG

I used printing according the example of matplotlib printing_in_wx.py.

...
self.canvas = FigureCanvasWx(self.panel, -1, self.fig)
...
self.Bind(wx.EVT_MENU, self.onPrint, id=MENU_PRINT)
...
def onPrint(self,event=None):
self.canvas.Printer_Print(event=event)
...

BTW if I want to run this demo, Python crashes.

Any ideas?

Kind regards,
Stefanie--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib.lines.Line2D object at 0x283d310 - strange error

2009-05-27 Thread Sandro Tosi
Hi,

On Wed, May 27, 2009 at 13:29, ninjasmith henrylindsaysm...@gmail.com wrote:
 I'm a bit new to matplotlib and python.  I'm running ubuntu 64bit.  whenever
 I try and do anything with matplotlib I get an error similar to above.  it
 still works, i.e. when I run the show() command the plot will appear but all
 matplotplib commands return an error similar to above. for example

 In [15]: plot(a)
 Out[15]: [matplotlib.lines.Line2D object at 0x28487d0]

 In [16]: figure(2)
 Out[16]: matplotlib.figure.Figure object at 0x2ddc150

those are not error: what that line say is that you created an
instance of matplotlib.figure.Figure and that instance is located at
0x2ddc150 (it's a memory location).

if you do something like

p = plot(a)

you'll see this messages go away, since you assign the instance
reference to the variable p

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread guillaume ranquet
I'm currently trying to improve my app to render more and more data.
I'm wondering if matplotlib keeps an internal copy of the datas once the
plot function has been called?

from what I understand from python (I'm quite new to python), everything
 is reference and no implicit copies are done. I'm trying to check on
matplotlib if it's the case but I must admit I got some difficulties xD


to sum it up: can I del the arrays I just passed to an axis.plot ?


thanks for your help :)

This message contains confidential information and may contain information that 
is legally privileged.  If you have received this message by mistake, please 
immediately notify us and delete the original message. Thank you.  

Ce message contient des informations confidentielles.  S'il vous est parvenu 
par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
aucun usage et de n'en garder aucune copie.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Adapt animation_blit_qt4.py to a pure OO implementation (QT4 timerEvent)

2009-05-27 Thread Sandro Tosi
Hi all,
I'd like to adapt 'animation_blit_qt4.py' to a pure OO approach,
removing pylab from the code and move to something near to
'embedding_in_qt4.py'.

I tried a bit but failed miserably :(

What I'd like to achieve is use something like in
'embedding_in_qt4.py' but that can be updated using the timerEvent /
startTime paradigm (something similar to gobject.add_idle(func) but
this time for Qt4).

Can someone please give me a help on this?

Thanks a lot in advance,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib dropping points in complex plot?

2009-05-27 Thread Michael Droettboom
You can set the rcParam path.simplify to False to turn off this behavior.

However, the goal is that the simplification is not noticable -- if it 
is that may be a bug.  Are you able to share your data so I can look 
into this further?

Cheers,
Mike

Will Grover wrote:
 Hello matplotlib users,

 I'm using matplotlib to plot some large data sets (1 million x,y
 pairs) and I've noticed that, when zoomed out to view the whole plot,
 it looks as if only every Nth point is being plotted, maybe in an
 attempt to improve plotting performance in complex plots.  When I zoom
 in I can see points that were clearly missing in the zoomed-out view.
 Is there any way to override this so that the plot really does show
 all the points, regardless of zoom?  I've included my really simple
 plotting code below, and I'm using the scipy superpack (python 2.5,
 matplotlib-0.98.6) on an OS X 10.5.7 Mac.

 Many thanks for any help!

--Will



 import pylab
 import smr
 import sys
 for freqs, stats, chronos in smr.loadData(sys.argv[1:]):  # loads data
 into numpy.arrays
   pylab.plot(chronos, freqs)
   pylab.show()

 --
 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
 is a gathering of tech-side developers  brand creativity professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing,  
 iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
 Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread Michael Droettboom
Yes, Python is reference counted (with a garbage collector to handle 
cycles etc.).  So, yes, the matplotlib plot keeps a reference to your 
data after you pass it in so it continue to redraw it as the plot is 
panned/zoomed/resized etc.  You can safely del your local reference, but 
the memory itself will not be freed, since matplotlib still needs it.

Mike

guillaume ranquet wrote:
 I'm currently trying to improve my app to render more and more data.
 I'm wondering if matplotlib keeps an internal copy of the datas once the
 plot function has been called?

 from what I understand from python (I'm quite new to python), everything
  is reference and no implicit copies are done. I'm trying to check on
 matplotlib if it's the case but I must admit I got some difficulties xD


 to sum it up: can I del the arrays I just passed to an axis.plot ?


 thanks for your help :)
 
 This message contains confidential information and may contain information 
 that is legally privileged.  If you have received this message by mistake, 
 please immediately notify us and delete the original message. Thank you.  

 Ce message contient des informations confidentielles.  S'il vous est parvenu 
 par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
 aucun usage et de n'en garder aucune copie.
 

 --
 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
 is a gathering of tech-side developers  brand creativity professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing,  
 iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
 Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread guillaume ranquet
Thanks Mike,
I just wanted to be sure wether matplotlib had a copy or not.
I'll have to work on giving hints to the GC then...

guillaume.

Michael Droettboom wrote:
 Yes, Python is reference counted (with a garbage collector to handle
 cycles etc.).  So, yes, the matplotlib plot keeps a reference to your
 data after you pass it in so it continue to redraw it as the plot is
 panned/zoomed/resized etc.  You can safely del your local reference, but
 the memory itself will not be freed, since matplotlib still needs it.
 
 Mike
 
 guillaume ranquet wrote:
 I'm currently trying to improve my app to render more and more data.
 I'm wondering if matplotlib keeps an internal copy of the datas once the
 plot function has been called?

 from what I understand from python (I'm quite new to python), everything
  is reference and no implicit copies are done. I'm trying to check on
 matplotlib if it's the case but I must admit I got some difficulties xD


 to sum it up: can I del the arrays I just passed to an axis.plot ?


 thanks for your help :)
 
 This message contains confidential information and may contain
 information that is legally privileged.  If you have received this
 message by mistake, please immediately notify us and delete the
 original message. Thank you. 
 Ce message contient des informations confidentielles.  S'il vous est
 parvenu par erreur, merci de bien vouloir nous en aviser par retour,
 de n'en faire aucun usage et de n'en garder aucune copie.
 

 --

 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like
 Barbarian Group, R/GA,  Big Spaceship.
 http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
 


This message contains confidential information and may contain information that 
is legally privileged.  If you have received this message by mistake, please 
immediately notify us and delete the original message. Thank you.  

Ce message contient des informations confidentielles.  S'il vous est parvenu 
par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
aucun usage et de n'en garder aucune copie.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread Michael Droettboom
I don't follow...  If you need to free the data, you have to ensure that 
matplotlib doesn't need it, and the only way to do that is destroy the 
figure that references it.  It's virtually impossible to create a 
dangling reference in Python (from within Python).

Mike

guillaume ranquet wrote:
 Thanks Mike,
 I just wanted to be sure wether matplotlib had a copy or not.
 I'll have to work on giving hints to the GC then...

 guillaume.

 Michael Droettboom wrote:
   
 Yes, Python is reference counted (with a garbage collector to handle
 cycles etc.).  So, yes, the matplotlib plot keeps a reference to your
 data after you pass it in so it continue to redraw it as the plot is
 panned/zoomed/resized etc.  You can safely del your local reference, but
 the memory itself will not be freed, since matplotlib still needs it.

 Mike

 guillaume ranquet wrote:
 
 I'm currently trying to improve my app to render more and more data.
 I'm wondering if matplotlib keeps an internal copy of the datas once the
 plot function has been called?

 from what I understand from python (I'm quite new to python), everything
  is reference and no implicit copies are done. I'm trying to check on
 matplotlib if it's the case but I must admit I got some difficulties xD


 to sum it up: can I del the arrays I just passed to an axis.plot ?


 thanks for your help :)
 
 This message contains confidential information and may contain
 information that is legally privileged.  If you have received this
 message by mistake, please immediately notify us and delete the
 original message. Thank you. 
 Ce message contient des informations confidentielles.  S'il vous est
 parvenu par erreur, merci de bien vouloir nous en aviser par retour,
 de n'en faire aucun usage et de n'en garder aucune copie.
 

 --

 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like
 Barbarian Group, R/GA,  Big Spaceship.
 http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
   

 
 This message contains confidential information and may contain information 
 that is legally privileged.  If you have received this message by mistake, 
 please immediately notify us and delete the original message. Thank you.  

 Ce message contient des informations confidentielles.  S'il vous est parvenu 
 par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
 aucun usage et de n'en garder aucune copie.
 

 --
 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
 is a gathering of tech-side developers  brand creativity professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing,  
 iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
 Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread guillaume ranquet
sorry If my last message was confusing.
I'm exctracting data from an xml file (100megs of xml) which is stored
by my app as an array of dict in which I pick only some keys to plot.
I'm just trying to figure out if the gc is able to free some parts of
the dict (the un-plotted parts) by itself (and it seems not) or If I
have to give more hints to the gc.
my gig of ram is getting used, and I'd like to increase the set of data
a bit.

I can make a hardcopy of my datas, pass this copy to matplotlib and del
everything (so that it *should* be clean, from my understandings).

actually, my design is quite horrible. prolly a rewrite from scratch is
the best thing to do.

anyway, it's a bit off-topic on the matplotlib user list :)

Michael Droettboom wrote:
 I don't follow...  If you need to free the data, you have to ensure that
 matplotlib doesn't need it, and the only way to do that is destroy the
 figure that references it.  It's virtually impossible to create a
 dangling reference in Python (from within Python).
 
 Mike
 
 guillaume ranquet wrote:
 Thanks Mike,
 I just wanted to be sure wether matplotlib had a copy or not.
 I'll have to work on giving hints to the GC then...

 guillaume.

 Michael Droettboom wrote:
  
 Yes, Python is reference counted (with a garbage collector to handle
 cycles etc.).  So, yes, the matplotlib plot keeps a reference to your
 data after you pass it in so it continue to redraw it as the plot is
 panned/zoomed/resized etc.  You can safely del your local reference, but
 the memory itself will not be freed, since matplotlib still needs it.

 Mike

 guillaume ranquet wrote:

 I'm currently trying to improve my app to render more and more data.
 I'm wondering if matplotlib keeps an internal copy of the datas once
 the
 plot function has been called?

 from what I understand from python (I'm quite new to python),
 everything
  is reference and no implicit copies are done. I'm trying to check on
 matplotlib if it's the case but I must admit I got some difficulties xD


 to sum it up: can I del the arrays I just passed to an axis.plot ?


 thanks for your help :)
 
 This message contains confidential information and may contain
 information that is legally privileged.  If you have received this
 message by mistake, please immediately notify us and delete the
 original message. Thank you. Ce message contient des informations
 confidentielles.  S'il vous est
 parvenu par erreur, merci de bien vouloir nous en aviser par retour,
 de n'en faire aucun usage et de n'en garder aucune copie.
 

 --


 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like
 Barbarian Group, R/GA,  Big Spaceship.
 http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 

 
 This message contains confidential information and may contain
 information that is legally privileged.  If you have received this
 message by mistake, please immediately notify us and delete the
 original message. Thank you. 
 Ce message contient des informations confidentielles.  S'il vous est
 parvenu par erreur, merci de bien vouloir nous en aviser par retour,
 de n'en faire aucun usage et de n'en garder aucune copie.
 

 --

 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like
 Barbarian Group, R/GA,  Big Spaceship.
 http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
 


This message contains confidential information and may contain information that 
is legally privileged.  If you have received this message by mistake, please 
immediately notify us and delete the original message. Thank you.  

Ce message contient des informations confidentielles.  S'il vous est parvenu 
par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
aucun usage et de n'en garder aucune copie.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, 

Re: [Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread Michael Droettboom
It's not off topic -- and I understand what you're trying to do much 
better now.

I assume at some point you convert all of the xml into a Numpy array and 
pass that to matplotlib?  matplotlib will only keep a reference to the 
Numpy array, which should be far more compact, and you can safely remove 
the references to the xml tree and that memory should be freed.

Cheers,
Mike

guillaume ranquet wrote:
 sorry If my last message was confusing.
 I'm exctracting data from an xml file (100megs of xml) which is stored
 by my app as an array of dict in which I pick only some keys to plot.
 I'm just trying to figure out if the gc is able to free some parts of
 the dict (the un-plotted parts) by itself (and it seems not) or If I
 have to give more hints to the gc.
 my gig of ram is getting used, and I'd like to increase the set of data
 a bit.

 I can make a hardcopy of my datas, pass this copy to matplotlib and del
 everything (so that it *should* be clean, from my understandings).

 actually, my design is quite horrible. prolly a rewrite from scratch is
 the best thing to do.

 anyway, it's a bit off-topic on the matplotlib user list :)

 Michael Droettboom wrote:
   
 I don't follow...  If you need to free the data, you have to ensure that
 matplotlib doesn't need it, and the only way to do that is destroy the
 figure that references it.  It's virtually impossible to create a
 dangling reference in Python (from within Python).

 Mike

 guillaume ranquet wrote:
 
 Thanks Mike,
 I just wanted to be sure wether matplotlib had a copy or not.
 I'll have to work on giving hints to the GC then...

 guillaume.

 Michael Droettboom wrote:
  
   
 Yes, Python is reference counted (with a garbage collector to handle
 cycles etc.).  So, yes, the matplotlib plot keeps a reference to your
 data after you pass it in so it continue to redraw it as the plot is
 panned/zoomed/resized etc.  You can safely del your local reference, but
 the memory itself will not be freed, since matplotlib still needs it.

 Mike

 guillaume ranquet wrote:

 
 I'm currently trying to improve my app to render more and more data.
 I'm wondering if matplotlib keeps an internal copy of the datas once
 the
 plot function has been called?

 from what I understand from python (I'm quite new to python),
 everything
  is reference and no implicit copies are done. I'm trying to check on
 matplotlib if it's the case but I must admit I got some difficulties xD


 to sum it up: can I del the arrays I just passed to an axis.plot ?


 thanks for your help :)
 
 This message contains confidential information and may contain
 information that is legally privileged.  If you have received this
 message by mistake, please immediately notify us and delete the
 original message. Thank you. Ce message contient des informations
 confidentielles.  S'il vous est
 parvenu par erreur, merci de bien vouloir nous en aviser par retour,
 de n'en faire aucun usage et de n'en garder aucune copie.
 

 --


 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like
 Barbarian Group, R/GA,  Big Spaceship.
 http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
   
 
 This message contains confidential information and may contain
 information that is legally privileged.  If you have received this
 message by mistake, please immediately notify us and delete the
 original message. Thank you. 
 Ce message contient des informations confidentielles.  S'il vous est
 parvenu par erreur, merci de bien vouloir nous en aviser par retour,
 de n'en faire aucun usage et de n'en garder aucune copie.
 

 --

 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like
 Barbarian Group, R/GA,  Big Spaceship.
 http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
   

 
 This message contains confidential information and may contain information 
 that is legally privileged.  If you have received this message by mistake, 
 please immediately notify us and delete the original message. Thank you.  

 Ce message 

[Matplotlib-users] rc font sizes do not apply to math.text font sizes?

2009-05-27 Thread Chaitanya Krishna
Hi all,

I am using the following rc params for the text font size
plt.rc('font', size=10.0)
plt.rc('xtick', labelsize='small')
plt.rc('ytick', labelsize='small')
plt.rc('legend', fontsize='medium', numpoints=1)
plt.rc('mathtext', fontset='custom', it='serif:regular')

But font settings don't seem to be applied when I use
plt.ylabel(r'$\Delta\mu \ \left[\mu_{B}\right]$')

Everytime I need to change the fontsize when the depending on the size
of the figure. Can this be avoided or am I missing something? It would
be nice if the font settings also apply math.text.

Cheers,
Chaitanya

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Strange resize behaviour for qt backend

2009-05-27 Thread Ole Streicher
Hi,

I am using matplotlib for some data vizualization. To ensure a
consistent user interface among the whole application, I do the
scrolling/zooming stuff myself. So, for a diagram, a horizontal
scrollbar is displayed below the diagram that enabled to shift along the
x axis. This is (part of) the code:

8---
from PyQt4 import QtGui, QtCore
from matplotlib.figure import Figure,SubplotParams

class DiagramWidget(QtGui.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
layout = QtGui.QVBoxLayout(self)
self.diagram = InnerDiagramWidget(self)
self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self)
self.connect(self.scrollbar, QtCore.SIGNAL('valueChanged(int)'),
 self.diagram.scroll_event)
layout.addWidget(self.diagram)
layout.addWidget(self.scrollbar)
# ...

class InnerDiagramWidget(FigureCanvas):
def __init__(self, parent):
fig = Figure(facecolor = 'w', 
 subplotpars = SubplotParams(left = 0.08, right=0.96, 
 bottom = 0.1, top=0.98))
self.axes = fig.add_subplot(111)
FigureCanvas.__init__(self, fig)
FigureCanvas.setParent(self, parent)
FigureCanvas.setSizePolicy(self,
   QtGui.QSizePolicy.Expanding,
   QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)

def scroll_event(self, x):
pass # here is real code ofcourse
# ...
8---

However, when I put this DiagramWidget into a window and try to resize
it vertically by mouse (with some data ... about 4000 points), the
scrollbar is not alwas shown correctly.

One can see that the diagram widget size does not change with every mouse
move, and the scrollbar sometimes goes out of the visible window, where
it is unusable.

The similar occurres in the horizontal direction: sometimes the
scrollbar gets not updated properly. This is the case when the Figure
canvas takes a long time for update.

If I put the scrollbar on top of the widget, everything is fine, except
that is the wrong place for a scrollbar :-)

Is this a bug in FigureCanvas, in Qt or in my code? How can I debug and
solve this?

Best regards

Ole


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] free'ing the plotted data?

2009-05-27 Thread Christopher Barker
guillaume ranquet wrote:
 this is how I convert the xml into plottable arrays:
 
 def getnamefrom(name,src,what):
 extracts timestamps and 'what' from 'src' for 'name'
 buffwhat = []
 bufftime = []
 sortedbyname = []
 [sortedbyname.append(element) for
 element in src if
 element[name] == name]
 for i in sortedbyname[:-1]:
 if i['name'] == name:
 bufftime.append(i[timestamp]/1e9)
 buffwhat.append(i[what])
 return buffwhat,bufftime
 
 x,y = getnamefrom(cpu0,cpustat,usage)
 plt.plot(x,y)
 del cpustat
 
 
 (yes, it's a hardware monitor :D)
 basically, it seems cpustat is still refcounted somewhere.

what is cpustat? ans elementtree? Anyway, it sure looks like x and y 
should be full of copies of the data, so you don't have any references 
that would keep cpustat alive.

Also, it looks like x and y are lists -- when you pass those into MPL, 
they will be copied to numpy arrays, so you can delete them too, jsut in 
case they are keeping references to cpustat items.

  I wonder if I should append(copy.copy(i[...])) instead?

rather than that, I'd copy to numpy arrays explicitly:

return np.array(buffwhat), np.array(bufftime)

That's what MPL uses internally anyway, and you'll be clear what you 
want. If you know how many items you'll have to begin with, you can put 
the data into np.arrays directly (np.arrays do not support appending).

 or If I'm mis-interpreting what I see with top.

you could be -- Python does not necessarily give memory back to the 
system when it's done with it -- but it should be able to re-use it.

  I'm trying  to get infos directly from the gc atm.

you could use sys.getrefcount() (note that it creates a reference 
itself, so it's always at least 2), but that may nothelp, as it may not 
be the elementree that has multiple references, but rather something 
inside itThis is very tricky business -- Python frees you from 
worrying about memory management almost all the time, but it does mean 
that you give up control.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Printing in wx

2009-05-27 Thread Christopher Barker
Stefanie Lück wrote:
 I'm trying to print my plots in a wxScrolledPanel under Windows XP but 
 it dosen't work. I only can print / preview the start of the plot on the 
 left upper site, the rest of page is empty:

I wonder if that has to do with how you are using the scolledpanel, and 
DCs. Post a sample (as a as-small-as-possible-running-app, if you can), 
and we can take a look.


 I used printing according the example of matplotlib printing_in_wx.py.

 BTW if I want to run this demo, Python crashes.

it works fine for me on OS-X

What messages to you get with your crash? What versions of Python, 
wxPython and MPL are you running?

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Malloc error on show() with Wx/WxAgg

2009-05-27 Thread Tony S Yu
I'm running into a really bizarre error that seems to have started  
spontaneously (no changes I can think of were made to my system in the  
last few days and mpl was plotting without problems up until a few  
hours ago). When using WxAgg, the following code raises a malloc error.

  import matplotlib.pyplot as plt
  plt.plot([0, 1])
  plt.show()

Python(477,0xa0710720) malloc: *** error for object 0x220068: Non- 
aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug

This error only occurs on the Wx/WxAgg backends AND when show() is  
called; Qt4Agg, TkAgg, and MacOSX backends work fine.

This error is also generated when starting ipython with the pylab flag  
(and WxAgg set as the default backend).

Sorry I can't give more information about the error itself; I'm not  
sure how to in this case.

Thanks in advance for your help,
-Tony

Mac OS X 10.5.7
Python 2.5.1
Matplotlib trunk r7142
WX 2.8.4.0 (mac-unicode)

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib dropping points in complex plot?

2009-05-27 Thread Eric Firing
Michael Droettboom wrote:
 You can set the rcParam path.simplify to False to turn off this behavior.

Mike,

The matplotlibrc.template indicates that this is effective only for 
vector backends; is the template comment incorrect?

Eric

#path.simplify : False  # When True, simplify paths in vector backends, 
such as
 # PDF, PS and SVG
#path.simplify_threshold : 0.1  # The threshold of similarity below which
 # vertices will be removed in the 
simplification
 # process


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib dropping points in complex plot?

2009-05-27 Thread Michael Droettboom
Good find.  The comment is out of date.  It is now followed in all 
backends.  I will update the template.

Mike

Eric Firing wrote:
 Michael Droettboom wrote:
 You can set the rcParam path.simplify to False to turn off this 
 behavior.

 Mike,

 The matplotlibrc.template indicates that this is effective only for 
 vector backends; is the template comment incorrect?

 Eric

 #path.simplify : False  # When True, simplify paths in vector 
 backends, such as
 # PDF, PS and SVG
 #path.simplify_threshold : 0.1  # The threshold of similarity below which
 # vertices will be removed in the 
 simplification
 # process


-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Malloc error on show() with Wx/WxAgg

2009-05-27 Thread Tony S Yu
Correction, this error occurs on all GUI backends I've tried (I don't  
have gtk installed). The malloc error didn't occur on the other  
backends until I tried to interact with the plot window.

-T


On May 27, 2009, at 12:36 PM, Tony S Yu wrote:

 I'm running into a really bizarre error that seems to have started
 spontaneously (no changes I can think of were made to my system in the
 last few days and mpl was plotting without problems up until a few
 hours ago). When using WxAgg, the following code raises a malloc  
 error.

 import matplotlib.pyplot as plt
 plt.plot([0, 1])
 plt.show()

 Python(477,0xa0710720) malloc: *** error for object 0x220068: Non-
 aligned pointer being freed
 *** set a breakpoint in malloc_error_break to debug

 This error only occurs on the Wx/WxAgg backends AND when show() is
 called; Qt4Agg, TkAgg, and MacOSX backends work fine.

 This error is also generated when starting ipython with the pylab flag
 (and WxAgg set as the default backend).

 Sorry I can't give more information about the error itself; I'm not
 sure how to in this case.

 Thanks in advance for your help,
 -Tony

 Mac OS X 10.5.7
 Python 2.5.1
 Matplotlib trunk r7142
 WX 2.8.4.0 (mac-unicode)

 --
 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity  
 professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like  
 Barbarian
 Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adapt animation_blit_qt4.py to a pure OO implementation (QT4 timerEvent)

2009-05-27 Thread Darren Dale
On Wed, May 27, 2009 at 9:11 AM, Sandro Tosi mo...@debian.org wrote:

 Hi all,
 I'd like to adapt 'animation_blit_qt4.py' to a pure OO approach,
 removing pylab from the code and move to something near to
 'embedding_in_qt4.py'.

 I tried a bit but failed miserably :(

 What I'd like to achieve is use something like in
 'embedding_in_qt4.py' but that can be updated using the timerEvent /
 startTime paradigm (something similar to gobject.add_idle(func) but
 this time for Qt4).

 Can someone please give me a help on this?


Can you be more specific? Maybe post what you have along with a description
of how it is failing?

Darren
--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib dropping points in complex plot?

2009-05-27 Thread Will Grover
Hello Mike,

Thanks for the quick reply - I'll try path.simplify as you suggest.
My actual data is pretty big and unruly, but I wrote a bit of code
that demonstrates the point dropping.  This code plots three
single-point-wide peaks on a baseline of noise that is 'length' points
long.  For smaller values of 'length' all three points are visible,
but for larger values some or all of the points disappear.  Maybe it's
unrealistic to think that all single-point outliers should always be
visible at any scale, but in this case these three points are
significantly different from all the baseline points and dropping them
obviously makes for a much different looking plot.  My actual data
doesn't have single-point peaks like this, but it does have
~50-point-wide peaks in a ~1,000,000 point plot, and many of those
peaks are routinely shortened or eliminated in the zoomed-out plot of
my data, only to reappear when adequately zoomed-in.

Tell me if there's any thing else I can provide you with, or if this
is just the way things are when plotting big data sets.  Thanks again,

  -- Will


###
import numpy
import pylab
#   When length = 2000, this usually plots all 3 peaks
#   When length = 5000, this plots 3, 2, 1, or 0 peaks
length = 2000
x = numpy.arange(length)
y = numpy.random.normal(loc=0.0, scale=1.0, size=length)
y[int(length*0.4)] = 100.0
y[int(length*0.5)] = 100.0
y[int(length*0.6)] = 100.0
pylab.plot(x,y)
pylab.show()
###










On Wed, May 27, 2009 at 6:32 AM, Michael Droettboom md...@stsci.edu wrote:
 You can set the rcParam path.simplify to False to turn off this behavior.

 However, the goal is that the simplification is not noticable -- if it is
 that may be a bug.  Are you able to share your data so I can look into this
 further?

 Cheers,
 Mike

 Will Grover wrote:

 Hello matplotlib users,

 I'm using matplotlib to plot some large data sets (1 million x,y
 pairs) and I've noticed that, when zoomed out to view the whole plot,
 it looks as if only every Nth point is being plotted, maybe in an
 attempt to improve plotting performance in complex plots.  When I zoom
 in I can see points that were clearly missing in the zoomed-out view.
 Is there any way to override this so that the plot really does show
 all the points, regardless of zoom?  I've included my really simple
 plotting code below, and I'm using the scipy superpack (python 2.5,
 matplotlib-0.98.6) on an OS X 10.5.7 Mac.

 Many thanks for any help!

   --Will



 import pylab
 import smr
 import sys
 for freqs, stats, chronos in smr.loadData(sys.argv[1:]):  # loads data
 into numpy.arrays
        pylab.plot(chronos, freqs)
        pylab.show()


 --
 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a
 gathering of tech-side developers  brand creativity professionals. Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
 Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA



--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adapt animation_blit_qt4.py to a pure OO implementation (QT4 timerEvent)

2009-05-27 Thread Sandro Tosi
Hi Darren,
thanks for replying

On Wed, May 27, 2009 at 21:01, Darren Dale dsdal...@gmail.com wrote:
 On Wed, May 27, 2009 at 9:11 AM, Sandro Tosi mo...@debian.org wrote:

 Hi all,
 I'd like to adapt 'animation_blit_qt4.py' to a pure OO approach,
 removing pylab from the code and move to something near to
 'embedding_in_qt4.py'.

 I tried a bit but failed miserably :(

 What I'd like to achieve is use something like in
 'embedding_in_qt4.py' but that can be updated using the timerEvent /
 startTime paradigm (something similar to gobject.add_idle(func) but
 this time for Qt4).

 Can someone please give me a help on this?

 Can you be more specific? Maybe post what you have along with a description
 of how it is failing?

Eheh, sorry for being so generic: I wrote that email from work, while
the code I've worked on was at home ;)

So, the situation is this:

- animation_blit_qt4.py has a nice way to update the graph online,
using the timerEvent/startTimer
- animation_blit_qt4.py contains pylab staff (I want to avoid using)
- animation_blit_qt4.py uses the backend Qt4Agg not the backend object
- embedding_in_qt4.py uses an OO approach at embedding mpl in a qt4
widget/application.

The ultimate result I want to achieve is to embed mpl in a qt4
application but update the graph in realtime.

So I started modifying animation_blit_qt4.py to make it more OO :)

The attached script animation_blit_qt4_morph.py only replaced the
pylab parts with a mix of OO style and pyplot, and the timerEvent just
print the receive event without updating the graph.

As you can see, not much of what I need :(

What I'd like to achive is something similar to
embedding_in_qt4_morph.py but where the graph is updated
automatically like in an animation.

Your help will be appreciated a lot :)

Thanks,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
# For detailed comments on animation and the techniqes used here, see
# the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations

import os, sys
import matplotlib
matplotlib.use('Qt4Agg') # qt4 example
# matplotlib Figure object
from matplotlib.figure import Figure
import matplotlib.backends.backend_qt4agg as backend

from PyQt4 import QtCore, QtGui

ITERS = 1000

#import pylab as p
import matplotlib.pyplot as plt
import numpy as npy
import time

class BlitQT(QtCore.QObject):#, backend.FigureCanvas):
def __init__(self):
self.fig = Figure()
self.ax = self.fig.add_subplot(111)
self.canvas = self.ax.figure.canvas
self.ax.grid()

# By making this a child of the canvas we make sure that it is
# destroyed first and avoids a possible exception when the user clicks
# on the window's close box.
QtCore.QObject.__init__(self, self.canvas)

self.cnt = 0

# create the initial line
self.x = npy.arange(0,2*npy.pi,0.01)
self.line, = self.ax.plot(self.x, npy.sin(self.x), animated=True, lw=2)

#self.background = None
#self.old_size = 0, 0
plt.draw()
#backend.show()


def timerEvent(self, evt):
# See if the size has changed since last time round.
#current_size = self.ax.bbox.width, self.ax.bbox.height
print evt

#if self.old_size != current_size:
#self.old_size = current_size
#self.background = self.canvas.copy_from_bbox(self.ax.bbox)

# restore the clean slate background
#self.canvas.restore_region(self.background)
# update the data
self.line.set_ydata(npy.sin(self.x+self.cnt/10.0))
plt.draw()
# just draw the animated artist
#self.ax.draw_artist(self.line)
# just redraw the axes rectangle
#self.canvas.blit(self.ax.bbox)

if self.cnt==ITERS:
# print the timing info and quit
print 'FPS:' , ITERS/(time.time()-self.tstart)
sys.exit()

else:
self.cnt += 1

#p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
#p.grid() # to ensure proper background restore

app = BlitQT()
# for profiling
app.tstart = time.time()
app.startTimer(100)
backend.show()
#!/usr/bin/env python

# for command-line arguments
import sys
# Python Qt4 bindings
from PyQt4 import QtGui

# standard Matplotlib imports
import numpy as np
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure


class Qt4MplCanvas(FigureCanvas):
Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).
def __init__(self):
self.fig = Figure()
self.axes = self.fig.add_subplot(111)
# We want the axes cleared every time plot() is called
self.axes.hold(False)

self.x = np.arange(0.0, 3.0, 0.01)
self.y = np.cos(2*np.pi*self.x)
self.axes.plot(self.x, self.y)

FigureCanvas.__init__(self, self.fig)




[Matplotlib-users] pcolor getting slow

2009-05-27 Thread jinbo wang
Hi dear users,
   Recently I found pcolor took tremendously longer to draw a figure 
than contour or imshow. I am wondering if anyone had the same 
experience, or anyone knows why? Thank you very much!
Jinbo

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA,  Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users