From: Darren D. <dar...@co...> - 2008-01-16 00:11:06
|
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 |