# Problem with set_xlim

Considering the following script I would Expect a resulting y range of
(1, 2) but I get (1, 3). Is this a bug or a feature. I'm using python
2.5, matplotlib 0.87.7.

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure()
canvas = FigureCanvas(fig)
lines = (ax.plot([1, 2, 3], [1, 2, 3]),)
axes = fig.get_axes()[0]
axes.set_xlim((0, 2))
axes.grid(True)
canvas.print_figure('out.eps')

Kind regards
Berthold

···

--
G / \ L Germanischer Lloyd
phone: +49-40-36149-7374 -+----+- Vorsetzen 35 P.O.Box 111606
fax : +49-40-36149-7320 \__/ D-20459 Hamburg D-20416 Hamburg

You have to use set_ylim((0,2)) to set the y limits.

Cheers
Tommy

···

On Jan 4, 2007, at 11:09 AM, Berthold Höllmann wrote:

Considering the following script I would Expect a resulting y range of
(1, 2) but I get (1, 3). Is this a bug or a feature. I'm using python
2.5, matplotlib 0.87.7.

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure()
canvas = FigureCanvas(fig)
lines = (ax.plot([1, 2, 3], [1, 2, 3]),)
axes = fig.get_axes()[0]
axes.set_xlim((0, 2))
axes.grid(True)
canvas.print_figure('out.eps')

Kind regards
Berthold
--