Re: [Matplotlib-users] Problem with matplotlib.colors.LogNorm

2007-04-03 Thread Eric Firing
I think the problems with imshow and matshow of integer arrays are fixed 
now in svn.

Eric

Suresh Pillai wrote:
 So I been using the log scale provided by matplotlib.colors.LogNorm, but 
 have been seing bizarre behaviour.  Basically, high values are not 
 displayed properly.  I give simple examples below with just two possible 
 values in the matrix, but all the same issues arise with more varied 
 values.
 
 First notice that the high value (10) is displayed as being of 
 value=1:
 
 from pylab import *
 from matplotlib.colors import LogNorm
 
 matrix = ones((30,30))
 matrix = matrix*440
 matrix[29,29] = 10
 
 matshow(matrix, norm=LogNorm(vmin=1, vmax=100))
 colorbar()
 show()
 
 The cutoff value for incorrect display (for the scale I am using) seems to 
 be at 32000:
 
 from pylab import *
 from matplotlib.colors import LogNorm
 
 matrix = ones((30,30))
 matrix = matrix*440
 matrix[29,29] = 32000
 
 matshow(matrix, norm=LogNorm(vmin=1, vmax=100))
 colorbar()
 show()
 
 However, if the value is really high, the color displayed changes again, 
 although still not to the correct color (please try with values 918000, 
 92, and 999000 to see see it progress):
 
 from pylab import *
 from matplotlib.colors import LogNorm
 
 matrix = ones((30,30))
 matrix = matrix*440
 matrix[29,29] = 918000
 
 matshow(matrix, norm=LogNorm(vmin=1, vmax=100))
 colorbar()
 show()
 
 And if one specifies no limits to LogNorm, the colorbar displayed is 
 incomplete and the colour displayed is wrong in a different way then when 
 specifying the limits (try value = 999000 as well).
 
 from pylab import *
 from matplotlib.colors import LogNorm
 
 matrix = ones((30,30))
 matrix = matrix*440
 matrix[29,29] = 918000
 
 matshow(matrix, norm=LogNorm())
 colorbar()
 show()
 
 
 Either I am completely missing something or there is a major bug.
 
 I am using mpl checked out from svn on 26 March.
 
 Thanks,
 Suresh
 
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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


Re: [Matplotlib-users] matplotlib and py2exe

2007-04-03 Thread Giorgio Luciano
I tried to compile the file and it seems to work (send by Werner).
I'm also interested in the problem since I cannot succeed in compiling 
too with matplotlib (already followed the instruction found on py2exe)  
Hope to see how it develop and happy to know if anyone succeed in doing it
Giorgio
   

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


Re: [Matplotlib-users] matplotlib and py2exe

2007-04-03 Thread Giorgio Luciano
Hello Werner,
here is the file I try to compile.
It gave an error of missing DLL when i try to launch :(
no Idea why, since with you example everything works
(I'm using maplotlib 0.87.7)

Giorgio



import pylab as pyl
from scipy import *
from pyautosct import *
x=pyl.load('c:/temp/iris.txt')
#def pynipals
#return (lmat,smat,qcont,tcont,smat2,qcont2,tcont2)
[o,c]=x.shape
aut=raw_input('Autoscale data [y] or [n] ?')
# Start of autoscaling
if aut=='y':
 vard=var(x,axis=0)*(o/(o-1.0))
 stdn=sqrt(vard)# it differs from std in Matlab(tm) where  std is normalised
 stdon=ones((o,1))*stdn
 xmeann=ones((o,1))*x.mean(axis=0)
 xnorm=(x-xmeann)/stdon
 x=xnorm
# End of autoscaling
smat=zeros((o,c))
lmat=zeros((c,c))
xt=x
if oc:
 vp=zeros((1,o))
 varexp=zeros((1,o))
else:
 vp=zeros((1,c))
 varexp=zeros((1,c))
t=0
vartot=(x**2).sum()
sts=raw_input('Variance to be retained (max 99) ?')
st=int(sts)
st=round(st,1)
while vp.sum()st:
 t=t+1
 ss=(x**2).sum(axis=0)
 #ss=round_(ss, decimals=8)
 a=sort(ss)
 b=ss.argsort(kind='merge')
 xmax=xt[:,b[c-1]]
 s=(xmax*xmax).sum()
 diffi=1000
 while diffi0.001:
  rmax=dot(xmax,xt)/s
  rmaxsq=(rmax*rmax).sum()
  rmax=rmax/sqrt(rmaxsq)
  xmax=dot(xt,rmax)
  s2=(xmax*xmax).sum()
  diffi=abs(s2-s)
  s=s2  
 smat[:,t-1]=xmax
 lmat[t-1,:]=rmax
 varexp[0,t-1]=(xmax*xmax).sum()
 vp[0,t-1]=varexp[0,t-1]/vartot*100
 xmaxc=xmax[:,pyl.NewAxis]
 xt=xt-xmaxc*rmax
print vp
print diffi
ncs=raw_input('How many components ?')
nc=int(ncs)
lmat=lmat[arange(0,nc),:]
smat=smat[:,arange(0,nc)]
[a,b]=smat.shape
# Computation of T2 values
t2=zeros((o,1))
vvv=zeros((nc,nc))
for i in arange(1,nc+1):
 vvv[i-1,i-1]=varexp[0,i-1]/(o-1)
for i in arange(1,o+1):
 t2[i-1]= 
dot(dot(smat[i-1,arange(0,nc)],linalg.inv(vvv)),smat[i-1,arange(0,nc)])
### T2 contributions
ssq=empty((nc,1))
for i in arange(1,nc+1): 
  ssq[i-1,0]=vvv[i-1,i-1]
h=(1./sqrt(ssq))
k=h[:,0]
#it has to be a vector before using diag
tcont=dot(dot(dot(x,lmat.transpose()),diag((k))),lmat)
#Comparison with matlab -= ok =-
# Computation of Q values based on cross-validation (ng deletion groups)
ng=5;
q=zeros((o,1))
qcont=zeros((o,c))
for g in arange(1,ng+1):
 t=arange(g,o+1,ng)
 smattr=zeros((o,c))
 lmattr=zeros((c,c))
 xtr=x;
 xtr=delete(xtr,t-1, axis=0)
 xev=x[t-1,:]
 [rtr,c]=xtr.shape
 if aut=='y':
  sst=diag(ones((rtr,1))*std(xtr,axis=0)*sqrt((rtr/(rtr-1.0
  jj1=min(sst)
  jj2=argmin(sst)
  if jj1==0:
   print 'Error: variable ', int(jj2), ' constant in group ', int(g)
  aa=pyautosct(xtr,xev)
  xtr=aa[arange(0,rtr),:]
  [aah,aak]=aa.shape
  xev=aa[arange(rtr,size(aa,0)),:]
#Comparison with matlab -= ok =-
 xttr=xtr
 [ttrh,ttrk]=xttr.shape
 tt=0
##checked
 while ttnc:
  smattr=zeros((ttrh,nc))
  lmattr=zeros((nc,c))
  tt=tt+1
  ss=(xttr**2).sum(axis=0)
  a2=sort(ss)
  b2=ss.argsort(kind='merge')
  xmax=xttr[:,b2[c-1]]
  s=(xmax*xmax).sum()
 ##checked
  diffi=1000
  while diffi0.001:
   rmax=dot(xmax,xttr)/s
   rmaxsq=(rmax*rmax).sum()
   rmax=rmax/sqrt(rmaxsq)
   xmax=dot(xttr,rmax)
   s2=(xmax*xmax).sum()
   diffi=abs(s2-s)
   s=s2
  ##checked
  smattr[:,tt-1]=xmax
  lmattr[tt-1,:]=rmax
  xmaxc=xmax[:,pyl.NewAxis]
  xttr=xttr-xmaxc*rmax
 smatev=dot(xev,lmattr.transpose())
 reconstrev=dot(smatev,lmattr)
 for i in arange(1,size(xev,0)+1):
  tind=t-1
  
q[tind[i-1]]=((reconstrev[i-1,:]-xev[i-1,:])*(reconstrev[i-1,:]-xev[i-1,:])).sum()
  qcont[tind[i-1]]=(reconstrev[i-1,:]-xev[i-1,:])**2
print 'smat'
print smat
print 'lmat'
print lmat
print 'tcont'
print tcont
print 'qcont'
print qcont


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


[Matplotlib-users] question about standalone small software and teaching

2007-04-03 Thread Giorgio Luciano
Hello Dear All,
I just have a question for all that  uses python/numpy/scipy/matplotlib 
for making science.
I use with no problem in my computer  python+numpy+scipy+matplotlib and 
I'm very satisfied with them.
I was a matlab user. I still not have unearthed the power ot python but 
I'm happy to use a programming language and not a metalanguage. When I 
gave people my software (in matlab) the all ask me if I could compile 
and create some interface.
I tried to use matlab GUIs, succeded in creating, but then I had a lot 
of problems. Compiling not always worked. after compiling you have not a 
workspace and so I had to make all output as txt files... and so on.
Now that I use python I'm again with the same problem. I create easy 
routines (for chemometrics) and then people ask me if I can make a 
standalone program with interface.
I used orange and for NN it's surely one of the best, but I'm not good 
at programming widgets. Then I think about it, searched the web and 
didn't find anything.
What I'm searching is something similar to labview :)
At first I thought ... hey why people wat an interface, just use the 
console, and then after listening  to their reason I have to agree.
What do I generally do ? I have a matrix in txt, I apply my routines (a 
SVD, a PCA, a filter etc etc  written in python), plot them (using 
maplotlib) and then I want an output. that's it.
I started looking at various Qt etc. etc. but for me it's overhelming, 
because I think that the most important part should be dedicate to the 
routines creation and not to making a gui, compiling, etc. etc. I need 
simple command like people wants. grids, paste and copy, small working 
plots :)
I mean I can get crazy with setting my program, importing etc. etc. but 
I also have to say that needs and claim about writing simple guis, 
common paste and copy etc should be considered from someone there (we 
wait for the help of some guru that makes things easier ;)

thanks for reading the mail
Giorgio


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


[Matplotlib-users] Memory leak using matplotlib

2007-04-03 Thread Pellegrini Eric
Hi evebrybody,
   
  I started a discussion one week ago about a problem of memory leak using the 
following code:
   
  

  from Tkinter import *
  from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
  import pylab
   
  def display():
  mat = pylab.zeros((100,100))
  pylab.ioff()
  image = pylab.matshow(mat)
  pylab.ion()
  pylab.close()
  can = FigureCanvasTkAgg(image, master=frame)
  can.show()
  can.get_tk_widget().grid(row = 0,column = 0)
   
  root = Tk()
  frame = Frame(root)
  frame.grid(row = 0,column = 0)
  canvas = Canvas(frame, width = 240, height = 240, relief = sunken, bg = 
white) 
  canvas.grid()
  button = Button(root,text=DisplayMatrix,command = display)
  button.grid(row = 1,column = 0)
  
***
   
  up to now, I have not found any way to solve it and unfortunately the 
proposed hints did not solve the problem (gc_collect(), clf(), cla()). Is there 
something new about this ?
   
  thanks
   
  Eric


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


Re: [Matplotlib-users] matlab, idle, interactivity and teaching

2007-04-03 Thread Gary Ruben
I have to agree with Giorgio in general. Unfortunately, the threading 
support required by matplotlib isn't implemented in pyScripter, which 
means that it's a nice environment until you want to do some plotting, 
when it becomes a bit flaky. I haven't checked eclipse's behaviour with 
matplotlib.

Gary R.

Giorgio F. Gilestro wrote:
 A really great IDE for windows users is pyScripter (
 http://mmm-experts.com/Products.aspx?ProductId=4 )
 It's probably the best I could try so far (and it's free).
 
 cheers
 
 On 3/30/07, Tim Hirzel [EMAIL PROTECTED] wrote:
 As for a good IDE. I really like eclipse with pydev.  For easy
 student/beginner setup, easyclipse has a nice python eclipse distribution

 http://www.easyeclipse.org/site/distributions/index.html

 I think I've tried near every python IDE setup out there over the last
 couple years, and this one wins for me.

 tim

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


Re: [Matplotlib-users] Best way to plot grid point values on a map?

2007-04-03 Thread Jeff Whitaker
Simon Kammerer wrote:
 Hi list,

 what's the best (meaning most efficient/fastest) way to plot grid 
 point values on a map created with basemap?

 I'd like to plot the raw values of my data-array to the correspondig 
 gridpoints, instead of having it transformed to something like contour 
 or contourf. The ne plus ultra would be the ability to assing a 
 colormap, to control the font color of the plotted values...

 Regards
 Simon

   

Simon:  I don't know about efficiency, but this does what you want:

from pylab import show, title, arange, figure, title, arccos, pi, cm, 
text, sqrt
from matplotlib.colors import rgb2hex
from matplotlib.toolkits.basemap import Basemap
from matplotlib.numerix.random_array import uniform

# Plot a bunch of randomly distributed points on the earth.

# set up stereographic map centered on N. Pole.
m = Basemap(lon_0=-105,boundinglat=30.,resolution='l',
  area_thresh=1.,projection='npstere')
# number of points to plot.
npts = 300
# generate random points on a sphere,
# so that every small area on the sphere is expected
# to have the same number of points.
# http://mathworld.wolfram.com/SpherePointPicking.html
try: # this works for numpy
  u = uniform(0.,1.,size=npts)
  v = uniform(0.,1.,size=npts)
  z = uniform(0,100,size=npts)
except: # this works for Numeric/numarray
  u = uniform(0.,1.,shape=npts)
  v = uniform(0.,1.,shape=npts)
  z = uniform(0,100,shape=npts)
lons = 360.*u
lats = (180./pi)*arccos(2*v-1) - 90.
# transform lons and lats to map coordinates.
x,y = m(lons,lats)
# create a list of strings containing z values
zn = [ '%2i' % zz for zz in z ]
# plot numbers on map, colored by value.
vmin = 0; vmax = 100
cmap = cm.jet # use 'jet' colormap
for name,zval,xpt,ypt in zip(zn,z,x,y):
  # only plot values inside map region.
  if xpt  m.xmin and xpt  m.xmax and ypt  m.ymin and ypt  m.ymax:
  rgbcolor = cmap(1.-(zval-vmin)/(vmax-vmin))[:3]
  hexcolor = rgb2hex(rgbcolor)
  text(xpt,ypt,name,fontsize=9,weight='bold',color=hexcolor)
# draw coasts and fill continents.
m.drawcoastlines(linewidth=0.5)
m.fillcontinents()
# draw parallels and meridians.
delat = 20.
circles = arange(0.,90.,delat).tolist()+\
arange(-delat,-90,-delat).tolist()
m.drawparallels(circles)
delon = 45.
meridians = arange(0,360,delon)
m.drawmeridians(meridians,labels=[1,1,1,1])
title('Random Data Value at Random Points',y=1.075)
show()


HTH,

-Jeff

-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
325 BroadwayBoulder, CO, USA 80305-3328

S

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


[Matplotlib-users] animated scatter plot

2007-04-03 Thread Flavio Coelho

Hi,

I want to animate a scatter plot using the pylab interface. Something like
this:
ion()
s=scatter(x,y,s,c)
for i in range (10):
   #update data
   s.draw()

s is a RegularPolyCollection and thuse does not have a set_data method.

How am I supposed to update the data so that I can modify the plot?


--
Flávio Codeço Coelho
registered Linux user # 386432
get counted at http://counter.li.org
---
software gets slower faster than hardware gets faster
Niklaus Wirth's law
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing the black border around a plot?

2007-04-03 Thread Ken McIvor
On Apr 1, 2007, at 11:27 PM, Chelonian wrote:

 I'm new to matplotlib, and I can't even get this to work (let alone  
 the
 other fix of changing the colors).  Could you elaborate about how to
 implement this?  I've tried putting these lines in the __init__ of the
 PlotPanel() class, but I can't get it.  Any help is appreciated,  
 thank you.

It sounds like you're using WxMpl to embed matplotlib in something.   
If that's the case, you should look at the example code below.   
Otherwise, please send a short example script to the list.

Also, please note that disabling the frame effectively makes the  
figure's background transparent when using the WXAgg backend.  I'm  
not sure if this is the intended behavior.  If that's not what you  
want, you can probably just set the Figure's face and edge colors to  
the same thing using Figure.set_edgecolor() and Figure.set_facecolor().

Ken


import wxmpl
import wx

class MyPlotPanel(wxmpl.PlotPanel):
 def __init__(self, parent, id, **kwds):
 wxmpl.PlotPanel.__init__(self, parent, id, **kwds)

 fig = self.get_figure()
 fig.set_frameon(False)


if __name__ == '__main__':
 app = wx.PySimpleApp()

 frame = wx.Frame(None, -1, 'Frame Off')
 panel = MyPlotPanel(frame, -1)

 szr = wx.BoxSizer(wx.VERTICAL)
 szr.Add(panel, 1, wx.EXPAND|wx.ALL, 5)
 frame.SetSizer(szr)
 frame.Fit()

 axes = panel.get_figure().gca()
 axes.plot([0,1,2,3,4,5])

 frame.Show(True)
 app.MainLoop()

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


Re: [Matplotlib-users] question about standalone small software and teaching

2007-04-03 Thread Christopher Barker
First,

Please don't cross-post quite so much. I've only sent this to the 
matplotlib list. Maybe the scipy-users would be better, but I'm not on 
that one.

First:
What you want to do really is hard. One of the reasons is that each app 
is going to have its own simple needs. Also, GUIS really do take a lot 
of work. I've written simple command line scripts, then found wrapping a 
GUI around them takes three times as long to write as the scripts took 
in the first place. Yes, it could be easier, but it's always going to be 
a lot of work.

Second:
Matlab is an expensive, proprietary application, thus, if you don't 
build a stand-alone, your users need to buy Matlab to use your code. 
Python/scipy/numpy/mpl are all freely re-distributable, so you don't' 
have that problem. Maybe your users don't really need a stand-alone, but 
rather need an easy to install and use environment for running your 
code, command line and all.

Granted, there is no such complete package available at this point but 
there are efforts to make then, and you could also build your own. The 
Enthought build is good for Windows. Also be sure to check out qme-dev:

http://sourceforge.net/projects/qme-dev/

It's not complete yet, but looks pretty promising.

There are also efforts afoot to make it a bit easier to use py2exe, 
py2app, etc. for building stand-alones.

If you really do want to build a stand-alone GUI tool, there are a lot 
of ways to make really full-featured GUIs, though you're right, it takes 
quite a bit of work. Given the state of affairs right now, I'd take a 
look at Dabo (it's not just for database apps):

http://dabodev.com/

or PythonCard

http://pythoncard.sourceforge.net/

And figure out how to integrate MPL with them (probably with wxMPL).

Both of these projects seek to make it easier to build GUIs with 
wxPython, which I think is the best choice for cross-platform GUIs. 
Dabo, in particular, is oriented toward data-aware widgets, which could 
be a very good match for small scientific computation tools.

-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

[EMAIL PROTECTED]

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


Re: [Matplotlib-users] Memory leak using matplotlib

2007-04-03 Thread Eric Firing
Eric,

Not much progress, I think.  Memory leaks seem endemic to the gui 
backends, although Tk is by far the worst.  I have been trying to 
understand the gtk case in the hope of discovering some simple change in 
mpl code that might eliminate the problem there and turn out to be 
applicable to the other backends as well.  But I have not found the 
source of the problem, and it seems to occur even in a very simple test 
gui script using pure pygtk, with no mpl.  I need to do more testing to 
find out whether the gtk problem is specific to use of gtk.Toolbar, or 
whether it will occur with any nested widgets.  It seems that widgets 
are not getting destroyed completely; maybe there are some references 
lurking somewhere in the dark.  With gtk, the garbage collector does not 
find any cycles that it can't deal with, but if I remember correctly 
from earlier testing, this is not the case with Tk.

As a partial workaround, if you don't need the toolbar, try setting
rcParams['toolbar'] = None

This may make the leak much smaller.  I think the toolbar causes 
problems in all guis simply because it increases the complexity and 
number of widgets being tracked, if for no other reason.

I would be delighted if a gui guru would emerge with a thorough 
explanation and solution for the memory leaks occurring with repeated 
opening and closing of windows.

Eric



Pellegrini Eric wrote:
 Hi evebrybody,
  
 I started a discussion one week ago about a problem of memory leak using 
 the following code:
  
 
 from Tkinter import *
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
 import pylab
  
 def display():
 mat = pylab.zeros((100,100))
 pylab.ioff()
 image = pylab.matshow(mat)
 pylab.ion()
 pylab.close()
 can = FigureCanvasTkAgg(image, master=frame)
 can.show()
 can.get_tk_widget().grid(row = 0,column = 0)
  
 root = Tk()
 frame = Frame(root)
 frame.grid(row = 0,column = 0)
 canvas = Canvas(frame, width = 240, height = 240, relief = sunken, bg 
 = white)
 canvas.grid()
 button = Button(root,text=DisplayMatrix,command = display)
 button.grid(row = 1,column = 0)
 ***
  
 up to now, I have not found any way to solve it and unfortunately the 
 proposed hints did not solve the problem (gc_collect(), clf(), cla()). 
 Is there something new about this ?
  
 thanks
  
 Eric
 
 
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos 
 questions ! Profitez des connaissances, des opinions et des expériences 
 des internautes sur Yahoo! Questions/Réponses 
 http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com.
 
 
 
 
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 
 
 
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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


Re: [Matplotlib-users] matlab, idle, interactivity and teaching

2007-04-03 Thread Tim Hirzel
I've had similar problems running wxPython code under certain IDEs where 
things can go very poorly (dramatic crashing, or it just wont execute).  
At least with the wx or wxagg backends, I have no trouble running  
matplotlib demos such as ellipse_demo.py from inside eclipse+pydev.

-tim


Gary Ruben wrote:
 I have to agree with Giorgio in general. Unfortunately, the threading 
 support required by matplotlib isn't implemented in pyScripter, which 
 means that it's a nice environment until you want to do some plotting, 
 when it becomes a bit flaky. I haven't checked eclipse's behaviour with 
 matplotlib.

 Gary R.

 Giorgio F. Gilestro wrote:
   
 A really great IDE for windows users is pyScripter (
 http://mmm-experts.com/Products.aspx?ProductId=4 )
 It's probably the best I could try so far (and it's free).

 cheers

 On 3/30/07, Tim Hirzel [EMAIL PROTECTED] wrote:
 
 As for a good IDE. I really like eclipse with pydev.  For easy
 student/beginner setup, easyclipse has a nice python eclipse distribution

 http://www.easyeclipse.org/site/distributions/index.html

 I think I've tried near every python IDE setup out there over the last
 couple years, and this one wins for me.

 tim
   

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


   

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


Re: [Matplotlib-users] matplotlib and py2exe

2007-04-03 Thread Werner F. Bruhin
Hi Giorgio,

Giorgio Luciano wrote:
 Hello Werner,
 here is the file I try to compile.
 It gave an error of missing DLL when i try to launch :(
 no Idea why, since with you example everything works
 (I'm using maplotlib 0.87.7)
I assume the DLL not found is wxmsw26uh_vc.dll at least I believe that 
87.7 is already compiled against wxPython 2.6 Unicode (hopefully this 
dependency will go away with some future release of matplotlib), so you 
need to either use the Unicode version of wxPython 2.6 or do the 
following as mentioned earlier in this thread.

matplotlib/backends/_wxagg.pyd

to

matplotlib/backends/_wxagg not used.pyd

If it is another .dll missing it would help if you let us know the name 
and the exact exception.

Werner

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


[Matplotlib-users] Numpy 1.0.2: some improvements for matplotlib

2007-04-03 Thread David Cournapeau
Hi there,

A few months back, I complained about the slowness of the image 
function in matplotlib. One of the cullprit was a slow clip function; 
I've done a bit some work to improve the situation on numpy's side, 
efforts which were integrated in numpy 1.0.2. Now, when you clip a numpy 
array with scalar min and max values, you get a 5 to 30 fold speed-up; 
to get the maximum efficiency, you need inplace clipping (using the 
syntax a.clip(min, max, a) for a a numpy array). This makes image 
significantly faster (between 100 and 200 ms on recent computers), and I 
am sure in other functionalities of matplotlib as well.
cheers,

David

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


Re: [Matplotlib-users] matplotlib and py2exe

2007-04-03 Thread Daniel Stalder
Hello

I saw your thread and I have a related problem.
I use matplotlib (0.90.0.win32-py2.5) with wxPython
(2.8-win32-unicode-2.8.3.0-py25).
I use matplotlib with WXAgg and got the following error msg:
This application has failed to start because wxmsw26uh_vc.dll was not
found. Re-installing the application may fix this problem.

The error msg appears on import _wxagg in the file backend_wxagg.py

# try to load the WXAgg accelerator
try:
import _wxagg   the msg appears here
except ImportError:
_wxagg = None

I already had this problem with previous versions of both libraries.

Thanks for any help
Daniel


-Original Message-
From: Werner F. Bruhin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 4 April 2007 2:58 a.m.
To: [EMAIL PROTECTED]; matplot
Subject: Re: [Matplotlib-users] matplotlib and py2exe

Hi Giorgio,

Giorgio Luciano wrote:
 Hello Werner,
 here is the file I try to compile.
 It gave an error of missing DLL when i try to launch :(
 no Idea why, since with you example everything works
 (I'm using maplotlib 0.87.7)
I assume the DLL not found is wxmsw26uh_vc.dll at least I believe that 
87.7 is already compiled against wxPython 2.6 Unicode (hopefully this 
dependency will go away with some future release of matplotlib), so you 
need to either use the Unicode version of wxPython 2.6 or do the 
following as mentioned earlier in this thread.

matplotlib/backends/_wxagg.pyd

to

matplotlib/backends/_wxagg not used.pyd

If it is another .dll missing it would help if you let us know the name 
and the exact exception.

Werner

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

This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.


This electronic transmission and any documents accompanying this electronic
transmission contain confidential information belonging to the sender. This
information may be legally privileged. The information is intended only for
the use of the individual or entity named above. If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or the taking of any action in reliance on or regarding the
contents of this electronically transmitted information is strictly
prohibited. 


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


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