Hi Experts,

i just stumbled upon something i can't quite explain (or rather i think i can
explain it, but i cannot understand it):

Consider the following minimal example:

    plot([1], [2],'o-'); show()

draws a single point at coords (1,2) - perfectly fine.

but when i try to plot the same at (0,2), i get an error:

    plot([0], [2],'o-'); show()

--------------------------------------------------------------------------------
/usr/lib/python2.4/site-packages/matplotlib/pylab.py in plot(*args, **kwargs)
   2016         hold(h)
   2017     try:
-> 2018         ret =  gca().plot(*args, **kwargs)
   2019         draw_if_interactive()
   2020     except:

/usr/lib/python2.4/site-packages/matplotlib/axes.py in plot(self, *args, 
**kwargs)
   2788             lines.append(line)
   2789         lines = [line for line in lines] # consume the generator
-> 2790         self.autoscale_view()
   2791         return lines
   2792

/usr/lib/python2.4/site-packages/matplotlib/axes.py in autoscale_view(self)
    813
    814         locator = self.xaxis.get_major_locator()
--> 815         self.set_xlim(locator.autoscale())
    816         locator = self.yaxis.get_major_locator()
    817         self.set_ylim(locator.autoscale())

/usr/lib/python2.4/site-packages/matplotlib/ticker.py in autoscale(self)
    796         dmin, dmax = self.dataInterval.get_bounds()
    797         dmin, dmax = self.nonsingular(dmin, dmax, expander = 0.05)
--> 798         return take(self.bin_boundaries(dmin, dmax), [0,-1])
    799
    800

/usr/lib/python2.4/site-packages/matplotlib/ticker.py in bin_boundaries(self, 
vmin, vmax)
    766     def bin_boundaries(self, vmin, vmax):
    767         nbins = self._nbins
--> 768         scale, offset = scale_range(vmin, vmax, nbins)
    769         vmin -= offset
    770         vmax -= offset

/usr/lib/python2.4/site-packages/matplotlib/ticker.py in scale_range(vmin, 
vmax, n, threshold)
    731     dv = abs(vmax - vmin)
    732     meanv = 0.5*(vmax+vmin)
--> 733     var = dv/max(abs(vmin), abs(vmax))
    734     if var < 1e-12:
    735         return 1.0, 0.0

ZeroDivisionError: float division
--------------------------------------------------------------------------------

I assume this is becaus matplotlib is unable to figure out the width to which 
it should scale the plot...


Any idea how to fix this?

thanks in advance,


Holger

Attachment: pgpStjfTt7yo5.pgp
Description: PGP signature

-------------------------------------------------------------------------
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.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to