Hello,
The situation (at least in my case) has definitely improved (for now) 
after adding a clf() command at the end of every figure I generate.
Somehow, it looks like pylab cannot properly "forget" the previous 
figure before drawing a new one unless you explicitly tell it.
Maybe it is worth a try.
Cheers

Lorenzo


Darren Dale wrote:
> Hi Lorenzo,
>
> On Tuesday 15 January 2008 4:14:24 pm Lorenzo Isella wrote:
>   
>> Dear All,
>> I am sending this email out of frustration, but I hope that someone will
>> be able to tell me what is going on.
>> I am using pylab on a Debian testing box.
>> I have the feeling that there is some problem with pylab when I
>> alternate, as I am doing now, many linear and log-log plots. Very often,
>> pylab complains about the fact that I cannot take the log of a negative
>> number even if all the quantities are positive or even if I have
>> replaced the loglog with a linear plot...
>> An example (sorry but there are long arrays involved and I cannot
>> reproduce all my code here):
>>
>>
>> #! /usr/bin/env python
>>
>> import scipy as s
>> import numpy as n
>> import pylab as p
>> #from rpy import r
>> #import distance_calc as d_calc
>>
>> # now I try performing a least-square fitting
>> import scipy.optimize as sopt
>>
>>
>> #do my stuff here
>>
>> print "my_n_clus_fit is, ", my_n_clus_fit
>> print "my_r_sq_fit",my_r_sq_fit
>> print "n_clu_rep2 is, ", n_clu_rep2
>> print "R_sq is", R_sq
>>
>> p.plot(n_clu_rep2,R_sq,"bo",my_n_clus_fit,my_r_sq_fit, "ro")
>> p.xlabel('particles in cluster')
>> p.ylabel('R square')
>> #p.legend(('beta=1e-2,100 part','beta=1e-1, 100 part', 'beta=1e-1, 200
>> part'))
>> p.title('Cluster-size vs average radius of gyration')
>> p.grid(True)
>> p.savefig("R_gyr_vs_N_fit.pdf")
>> p.hold(False)
>>
>> and the relevant part of the output is:
>>     
>
> [...]
>   
>> Traceback (most recent call last):
>>   File "./r_gyr.py", line 322, in ?
>>     p.plot(n_clu_rep2,R_sq,"bo",my_n_clus_fit,my_r_sq_fit, "ro")
>>   File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
>> 2028, in plot
>>     ret =  gca().plot(*args, **kwargs)
>>   File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 2540,
>> in plot
>>     self.autoscale_view(scalex=scalex, scaley=scaley)
>>   File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1207,
>> in autoscale_view
>>     self.set_xlim(XL)
>>   File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1493,
>> in set_xlim
>>     raise ValueError('Cannot set nonpositive limits with log transform')
>> ValueError: Cannot set nonpositive limits with log transform
>>     
>
>
> I think this is a bug. It sounds like the same issue I reported a while back: 
> http://www.nabble.com/Cannot-set-nonpositive-limits-with-log-transform-to12154187.html
>
> I havent had a chance to look into a solution. I filed a bug report at 
> sourceforge (1872462). I'm worried the fix will be disruptive, but several 
> people have run into this. I'm sorry you got bit as well.
>
> Darren
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to