Defining a precise x-axis max in plot()

Hi Eric,

You solved my problem; I called axis after the call to plot and the min-max obeyed my explicit definition.

The version of matplotlib that I am running is "python-matplotlib - 0.99.0-1ubuntu1 (amd64)".
Sorry for the incomplete code snippet that I submitted with my initial request. In the future I will submit working code.
Thank you for your swift response and thanks to all the matplotlib developers.

Sincerely,
Lee

···

On 01/24/2011 02:49 PM, Lionel (Lee) Brooks 3rd wrote:

> Hello Gentlepeople,
>
> I am plotting an integer array using: matplotlib.pyplot.plot().
> For my purposes it is imperative that the x-axis be explicitly defined.
> I have tried to achieve this by using: matplotlib.pyplot.axis(v).
> Where v is a list of integer values corresponding to the desired axes
> limits [xmin, xmax, ymin, ymax].
> However, the x-axis that is displayed does not obey my explicit xmax
> declaration; the value is rounded up.
>

I am not seeing the problem when I try what I think is a minimal example; what version of mpl are you using? And have you tried calling axis after the call to plot? This might have been necessary in some earlier versions; I don't recall.

(In ipython -pylab, my example was this:

ax1 = gca()
ax1.axis([0,9.9,0,9.9])
ax1.plot([1,2])
draw()

in which no rounding occurs.)