On Tuesday 14 August 2007 07:35:43 pm Darren Dale wrote: > I'm developing an application for work and need to plot some spectra on a > logscale. I can recreate my problem with embedding_in_qt4, by replacing > MyDynamicMplCanvas.compute_initial_figure with this: > > def compute_initial_figure(self): > self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') > self.axes.set_yscale('log') > > [...] > File > "/usr/lib64/python2.5/site-packages/matplotlib-0.90.1_r3709-py2.5-linux-x86 >_64.egg/matplotlib/axes.py", line 1664, in set_ylim > raise ValueError('Cannot set nonpositive limits with log transform') > ValueError: Cannot set nonpositive limits with log transform > > I get that error even if I modify the update figure function so there is no > possibility of zeros occuring in the data
I have tracked this back through axes.cla(), which is called when axes._hold is False, to axis.cla(). axis.cla() resets the locators, but the transforms are still set to mtrans.LOG10. Since plot is called by loglog, and semilog*, it shouldn't be using any methods that modify locators. If cla() resets the transforms, then the behavior of plot will be different, preserving log transforms when hold is True, but changing to linear transforms when hold is False. I wonder if cla() is trying to do too much. Maybe the initial setting of locators should be moved out of cla(), which is called by Axes.__init__, and into Axis.__init__. Then calls to cla() will preserve the scaling, and the behavior of plot() will be consistent, regardless of the whether hold is enabled or not. Darren ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel