|
From: Darren D. <dd...@co...> - 2005-03-17 01:36:12
|
On Wednesday 16 March 2005 07:59 pm, Darren Dale wrote:
> I suggest making the following change to ticker.py, starting
> at line 501 in version 0.72.1:
>
> def le(self, x):
> 'return the largest multiple of base <= x'
> d,m = divmod(x, self._base)
> if closeto(m/self._base,1): # was closeto(m, self._base)
> #looks like floating point error
> return (d+1)*self._base
> else:
> return d*self._base
>
I was testing this bugfix with plot([1.4e-12,3.0e-12]), and noticed that the
1.4e-12 ticklabel was being dropped.
In ticker.py, I suggest replacing Base.ge with:
def ge(self, x):
'return the largest multiple of base >= x'
d,m = divmod(x, self._base)
if closeto(m,0) and not closeto(m/self._base,1): return x
return (d+1)*self._base
The fourth line used to be if m==0: return x, which fails sometimes due to
floating point inaccuracy. John, remember I was complaining about how certain
ticklabels wouldnt get rendered in the new scalarformatter I posted a couple
weeks ago? This was the problem.
Darren
|