Bug with setting axis limits


I seem to have uncovered a bug in setting/updating the axis limits.

If you run the following example, you should see a straight line between
(0,0) and (1,1). Pressing the "Test Zoom" button should reset the axis
limits to the values depicted below. Basically, the X axis is clipped
between [0.1,0.8] and the Y axis limits are either [0.516,0.517] or
[0.5166,0.5167] depending on which of the two lines in the code below is
commented. The following bug(s) are seen:

1. In the first case, where the y axis limit is updated to
   [0.516,0.517], the line should be seen as a sharply vertical line
   passing starting from x=0.516 and continuing sharply upwards till
   x=0.517. However, the line seems to start significantly _after_

2. In the second case, if the ylim variable is changed to
   [0.5166,0.5167], then the line completely dissapears from the axes
   view. It seems to fall off the right edge (is my guess), whereas it
   should be seen as a more or less vertical line passing through

The test code is appended below the signature.


import matplotlib
from matplotlib.backends.backend_gtk import FigureCanvasGTK

from matplotlib.axes import Subplot
from matplotlib.figure import Figure
import gtk

class MyApp:
    def __init__(self):
        self.win = gtk.Window()
        self.win.set_name("Embedding in GTK")
        self.win.connect("destroy", gtk.mainquit)

        self.vbox = gtk.VBox(spacing=3)

        self.fig = Figure(figsize=(5,4), dpi=100)
        self.ax = Subplot(self.fig, 111)

        self.ax.plot([0,1], [0,1])

        self.canvas = FigureCanvasGTK(self.fig) # a gtk.DrawingArea

        buttonTestZoom = gtk.Button('Test Zoom')
        buttonTestZoom.connect('button_press_event', self.TestZoom)



    def TestZoom(self, widget, event):
        xlim = [0.1, 0.8]
        # this makes the line dissapear from the axes.
        #ylim = [0.5166, 0.5167]
        # this shows the line but in the wrong location!
        ylim = [0.516, 0.517]



if __name__=='__main__':
    app = MyApp()