On Wed, Aug 25, 2010 at 4:53 AM, xyz <mit...@op.pl> wrote:

> Thank you, but why the coordinates start from 2 and not from 0 with the
> following code?
>
> from pylab import *
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> for i in [[2,2], [2,3], [4.2,3.5]]:
>   print i[0],i[1]
>   plt.plot(i[0],i[1],'o')
>
> ax.grid(True)
> plt.legend(['Model length', 'Data length', 'test'],
>             'best', shadow=True, fancybox=True)
>
> plt.show()
>
> How is it possible that the coordinates start from 0?
>
>
>
I believe you are asking why the x axis starts at 2?  This is because
matplotlib will automatically set the limits of your plot to show all of
your data.  If you can control the axes yourself by calling set_xlim()
and/or set_ylim().

ax.set_xlim(0.0, 5.0)

would set the limits of your x axis to 0.0 and 5.0.  You can also do

ax.set_xlim(left=0.0)

to control only the left end of the axis (letting the right end be
automatically set).

I hope that helps!
Ben Root
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to