"""
    small example showing the difference in using ax.get_xlim()
    and the ax.set_xlim(), which both return the x limits

OUTPUT on my machine:

mpl :  0.98.3 $Revision: 6203 $
executing : a = ax.get_xlim()
    a             =  [ 0.  1.] <type 'numpy.ndarray'>
changing the x limits by 
  executing : ax.set_xlim(a*0.5)
also changes the array : 
    a             =  [ 0.5  1.5]
and changing the array a by 
executing : a*=34
leads to
    a             =  [ 21.  63.]
    ax.get_xlim() =  [ 21.  63.]


executing : b = ax.set_xlim() 
 yields an tuple (like in 0.91.4 with ax.get_xlim() / ax.set_xlim())
    b             =  (21.0, 63.0) <type 'tuple'>

To stress the difference between the returned array and tuple 
 also the following is remarkable : 
executing : a = ax.get_xlim()
executing : b = ax.set_xlim() 
 2*a =  [  42.  126.]
 2*b =  (21.0, 63.0, 21.0, 63.0)

"""
import matplotlib
from pylab import axes

print "mpl : ", matplotlib.__version__, matplotlib.__revision__

ax = axes()

print "executing : a = ax.get_xlim()"
a = ax.get_xlim()

print "    a             = ", a, type(a)

try:
    ax.set_xlim(a+0.5)
except TypeError:
    pass # a is a tuple
else:
    print "changing the x limits by "
    print "  executing : ax.set_xlim(a*0.5)"
    print "also changes the array : "
    print "    a             = ", a

    print "and changing the array a by "
    print "executing : a*=34"
    a *= 42
    print "leads to"
    print "    a             = ", a
    print "    ax.get_xlim() = ", ax.get_xlim()


print "\n"
print "executing : b = ax.set_xlim() "
b = ax.set_xlim()
print " yields an tuple (like in 0.91.4 with ax.get_xlim() / ax.set_xlim())"
print "    b             = ", b, type(b)

if type(a) is not tuple: 
    print 
    print "To stress the difference between the returned array and tuple "
    print " also the following is remarkable : "
    print "executing : a = ax.get_xlim()"
    print "executing : b = ax.set_xlim() "
    print " 2*a = ", 2*a
    print " 2*b = ", 2*b
