On Thu, May 15, 2008 at 10:20:23AM +0200, Friedrich Hagedorn wrote:
> Hello,
> 
> I think the following is'nt right:
> 
> In [1]: plot([1,2,3])
> Out[1]: [<matplotlib.lines.Line2D object at 0x8f9b0ec>]
> 
> In [2]: ylim(-4,4)
> Out[2]: (-4, 4)
> 
> In [3]: axhline()
> Out[3]: <matplotlib.lines.Line2D object at 0x8f9bc0c>
> 
> In [4]: ylim()
> Out[4]: (0.0, 3.0)

With the attached patch the thinks are ok:

In [1]: plot([1,2,3])
Out[1]: [<matplotlib.lines.Line2D object at 0x8f9b0ac>]

In [2]: ylim(-4,4)
Out[2]: (-4, 4)

In [3]: xlim(-4,4)
Out[3]: (-4, 4)

In [4]: axhline()
Out[4]: <matplotlib.lines.Line2D object at 0x8fa6e6c>

In [5]: axvline()
Out[5]: <matplotlib.lines.Line2D object at 0x9062fec>

In [6]: xlim()
Out[6]: (-4.0, 4.0)

In [7]: ylim()
Out[7]: (-4.0, 4.0)

By,

  Friedrich
Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py	(Revision 5008)
+++ lib/matplotlib/axes.py	(Arbeitskopie)
@@ -2435,9 +2435,14 @@
         %(Line2D)s
         """
 
+        autoscale = self.get_autoscale_on()
+        self.set_autoscale_on(False)
+
         trans = mtransforms.blended_transform_factory(
             self.transAxes, self.transData)
         l, = self.plot([xmin,xmax], [y,y], transform=trans, scalex=False, **kwargs)
+
+        self.set_autoscale_on(autoscale)
         return l
 
     axhline.__doc__ = cbook.dedent(axhline.__doc__) % martist.kwdocd
@@ -2472,9 +2477,14 @@
         %(Line2D)s
         """
 
+        autoscale = self.get_autoscale_on()
+        self.set_autoscale_on(False)
+
         trans = mtransforms.blended_transform_factory(
             self.transData, self.transAxes)
         l, = self.plot([x,x], [ymin,ymax] , transform=trans, scaley=False, **kwargs)
+
+        self.set_autoscale_on(autoscale)
         return l
 
     axvline.__doc__ = cbook.dedent(axvline.__doc__) % martist.kwdocd
-------------------------------------------------------------------------
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