[SciPy-user] Plotting an array

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Oct 10 13:59:29 EDT 2006


>>>>> "John" == John Hunter <jdhunter at ace.bsd.uchicago.edu> writes:

>>>>> "Andrew" == Andrew B Young <andrew.young at sri.com> writes:
    Andrew> Gael, The following little program-- -- test.py
    Andrew> ---------------------- | from scipy import arange, sin,
    Andrew> pi, interpolate | from pylab import plot, show, savefig |
    Andrew> t = arange(0, 2.0, 0.1) | plot(t) | savefig('test.png')

    Andrew> Produces the plot at http://polar.sri.com/~ayoung/test.png

    Andrew> Why does the plot "turn on" at one?  If I, plot( [ 0. ,
    Andrew> 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.  , 1.1,
    Andrew> 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9] ) I get what I
    Andrew> would expect: http://polar.sri.com/~ayoung/test2.png

    John> This looks odd; one possibility is that you are mixing your
    John> numerix packages.  Check you matplotlib rc setting.  If you

Yep, that's it.  I can reproduce it with an old Numeric and a newish
numpy/scipy.  The combination of versions below exposes the problem if
your rc setting is Numeric.  Either of the suggested changes I made in
my last post will fix your problem.

In [5]: import numpy; numpy.__version__ Out[5]: '0.9.6.2138'

In [6]: import scipy; scipy.__version__
Out[6]: '0.4.7.1617'

In [7]: import Numeric; Numeric.__version__
Out[7]: '23.1'


JDH



More information about the SciPy-User mailing list