From: Axel B. <a.a...@ai...> - 2006-12-01 14:53:11
|
Hello there, I have a strange plotting problem. In the example below I expect three equal plots of f, g and h: a simple inclined line, but g and h produce a sawtooth plot. What do I do wrong? Any help would be greatly appreceated. Sincerely, Axel Brink. import numpy, pylab f = range(500) g = numpy.array(range(500)) h = list(numpy.array(range(500))) pylab.plot(f) pylab.figure() pylab.plot(g) pylab.figure() pylab.plot(h) pylab.show() -- Axel Brink Ph.D student Artificial Intelligence University of Groningen www.ai.rug.nl/~axel Tel.: +31 (0)50 363 7410 Postal addr.: Grote Kruisstraat 2/1, 9712 TS, Groningen, The Netherlands Visiting addr.: Zernikepark 10, Groningen, The Netherlands |
From: John H. <jdh...@ac...> - 2006-12-01 15:00:07
|
>>>>> "Axel" == Axel Brink <a.a...@ai...> writes: Axel> Hello there, I have a strange plotting problem. In the Axel> example below I expect three equal plots of f, g and h: a Axel> simple inclined line, but g and h produce a sawtooth Axel> plot. What do I do wrong? Any help would be greatly Axel> appreceated. Not sure what your problem is -- I can run your script and get three identical lines as expected. My guess if you are mixing numpy with an incorrect matplotlib numerix setting. If you are creating your arrays with numpy, you need to set "numerix :numpy" in your matplotlibrc file http://matplotlib.sf.net/matplotlibrc You can find your numerix setting by running your script with > python myscript.py --verbose-helpful JDH |
From: Axel B. <a.a...@ai...> - 2006-12-01 15:37:38
|
> Axel> Hello there, I have a strange plotting problem. In the > Axel> example below I expect three equal plots of f, g and h: a > Axel> simple inclined line, but g and h produce a sawtooth > Axel> plot. What do I do wrong? Any help would be greatly > Axel> appreceated. > > Not sure what your problem is -- I can run your script and get three > identical lines as expected. > > My guess if you are mixing numpy with an incorrect matplotlib numerix > setting. If you are creating your arrays with numpy, you need to set > "numerix :numpy" in your matplotlibrc file > > http://matplotlib.sf.net/matplotlibrc > > > You can find your numerix setting by running your script with > > > python myscript.py --verbose-helpful > > JDH > John, thanks for your suggestion. I would never have thought of looking for the cause of the problem in that direction. However, it isn't solved yet. The verbose mode yielded the line "numerix Numeric 23.7", which is apparently wrong. Actually I am trying to use SciPy, which I've heard is based on NumPy, so I believe this numerix thing should be connected with NumPy. I copied the file http://matplotlib.sf.net/matplotlibrc to ~/.matplotlib/matplotlibrc (such a file didn't exist) and now I get a new kind of error (see below). Do you (or anyone) have an idea what this is about? Thanks in advance! Axel. > python datasetPrepare.py --verbose-helpful matplotlib data path /usr/lib/python2.4/site-packages/matplotlib/mpl-data $HOME=/staf/axel CONFIGDIR=/staf/axel/.matplotlib loaded rc file /staf/axel/.matplotlib/matplotlibrc matplotlib version 0.87.3 verbose.level helpful interactive is False platform is linux2 Traceback (most recent call last): File "datasetPrepare.py", line 1, in ? import glob, os, Image, pylab, scipy, scipy.signal, copy File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ? from matplotlib.pylab import * File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 196, in ? import cm File "/usr/lib/python2.4/site-packages/matplotlib/cm.py", line 5, in ? import colors File "/usr/lib/python2.4/site-packages/matplotlib/colors.py", line 33, in ? from numerix import array, arange, take, put, Float, Int, where, \ File "/usr/lib/python2.4/site-packages/matplotlib/numerix/__init__.py", line 68, in ? from _sp_imports import nx, infinity File "/usr/lib/python2.4/site-packages/matplotlib/numerix/_sp_imports.py", line 1, in ? from numpy import Int8, UInt8, \ ImportError: cannot import name Int8 -- Axel Brink Ph.D student Artificial Intelligence University of Groningen www.ai.rug.nl/~axel Tel.: +31 (0)50 363 7410 Postal addr.: Grote Kruisstraat 2/1, 9712 TS, Groningen, The Netherlands Visiting addr.: Zernikepark 10, Groningen, The Netherlands |
From: John H. <jdh...@ac...> - 2006-12-01 16:10:37
|
>>>>> "Axel" == Axel Brink <a.a...@ai...> writes: Axel> John, thanks for your suggestion. I would never have thought Axel> of looking for the cause of the problem in that Axel> direction. However, it isn't solved yet. The verbose mode Axel> yielded the line "numerix Numeric 23.7", which is apparently Axel> wrong. Actually I am trying to use SciPy, which I've heard Axel> is based on NumPy, so I believe this numerix thing should be Axel> connected with NumPy. I copied the file Axel> http://matplotlib.sf.net/matplotlibrc to Axel> ~/.matplotlib/matplotlibrc (such a file didn't exist) and Axel> now I get a new kind of error (see below). Do you (or Axel> anyone) have an idea what this is about? Thanks in advance! I'm sorry this is so frustrating -- it is certainly frustrating for me. The problem is that matplotlib is trying to support three array packages (Numeric, numarray and numpy) and numpy itself is a fast moving target so if you don't have exactly the right numpy with exactly the right scipy with exactly the right matplotlib it is unlikely to work. I suggest either the latest release of all three, or the latest svn of all three. I notice from your output that you have 0.87.3 which is several releases behind. Try getting numpy 1.0 and matplotlib 0.87.7. Good luck! JDH |
From: Gary <pa...@in...> - 2006-12-01 16:18:49
|
John Hunter wrote: >>>>>> "Axel" == Axel Brink <a.a...@ai...> writes: >>>>>> > Axel> John, thanks for your suggestion. I would never have thought > Axel> of looking for the cause of the problem in that > Axel> direction. However, it isn't solved yet. The verbose mode > Axel> yielded the line "numerix Numeric 23.7", which is apparently > Axel> wrong. Actually I am trying to use SciPy, which I've heard > Axel> is based on NumPy, so I believe this numerix thing should be > Axel> connected with NumPy. I copied the file > Axel> http://matplotlib.sf.net/matplotlibrc to > Axel> ~/.matplotlib/matplotlibrc (such a file didn't exist) and > Axel> now I get a new kind of error (see below). Do you (or > Axel> anyone) have an idea what this is about? Thanks in advance! > > I'm sorry this is so frustrating -- it is certainly frustrating for > me. The problem is that matplotlib is trying to support three array > packages (Numeric, numarray and numpy) and numpy itself is a fast > moving target so if you don't have exactly the right numpy with > exactly the right scipy with exactly the right matplotlib it is > unlikely to work. > > I suggest either the latest release of all three, or the latest svn of > all three. I notice from your output that you have 0.87.3 which is > several releases behind. Try getting numpy 1.0 and matplotlib 0.87.7. Windows users have to watch out: the current Scipy binary installer is out of sync with the current Numpy installer. (I think the Scipy people are going to fix that soon. In the meantime, I have a matched set of Numpy and Scipy installers for Windows and Python 2.4.3 that works with the latest mpl binary installer. I'm happy to provide my installers if anyone wants them. Contact me directly.) -gary > Good luck! > JDH > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Axel B. <a.a...@ai...> - 2006-12-04 09:57:04
|
This is just to let you know that I fixed the plot problem by installing the newest Matplotlib (0.87.7) and creating ~/.matplotlib/matplotlibrc. Adam, John and Gary, thank you very much! Axel. Gary wrote: >> Axel> John, thanks for your suggestion. I would never have thought >> Axel> of looking for the cause of the problem in that >> Axel> direction. However, it isn't solved yet. The verbose mode >> Axel> yielded the line "numerix Numeric 23.7", which is apparently >> Axel> wrong. Actually I am trying to use SciPy, which I've heard >> Axel> is based on NumPy, so I believe this numerix thing should be >> Axel> connected with NumPy. I copied the file >> Axel> http://matplotlib.sf.net/matplotlibrc to >> Axel> ~/.matplotlib/matplotlibrc (such a file didn't exist) and >> Axel> now I get a new kind of error (see below). Do you (or >> Axel> anyone) have an idea what this is about? Thanks in advance! >> >> I'm sorry this is so frustrating -- it is certainly frustrating for >> me. The problem is that matplotlib is trying to support three array >> packages (Numeric, numarray and numpy) and numpy itself is a fast >> moving target so if you don't have exactly the right numpy with >> exactly the right scipy with exactly the right matplotlib it is >> unlikely to work. >> >> I suggest either the latest release of all three, or the latest svn of >> all three. I notice from your output that you have 0.87.3 which is >> several releases behind. Try getting numpy 1.0 and matplotlib 0.87.7. >> > Windows users have to watch out: the current Scipy binary installer is > out of sync with the current Numpy installer. > (I think the Scipy people are going to fix that soon. In the meantime, > I have a matched set of Numpy and Scipy installers for Windows and > Python 2.4.3 that works with the latest mpl binary installer. I'm happy > to provide my installers if anyone wants them. Contact me directly.) > > -gary > > > >> Good luck! >> JDH >> |