#1
|
|||
|
|||
Matplotlib - Introduction
While past versions of Vizard have been compatible with Matplotlib and other 3rd party add-on toolkits, R3 is pre-configured to make the process easy—just as if you were installing them on an official Python.org release.
Matplotlib is a combination of NumPy and PyLab that together gives you a very “Matlab” like environment for generating publication quality figures. You can output to raster formats (e.g., PNG, TIFF, JPG) immediately in a pop-up window or to vector (e.g, EPS, PS) formats that are saved as files. The style of graphs and syntax for creating them—especially when combined with the added Python language constructs through NumPy—will be very familiar to users of Matlab. Unfortunately, it seems versions across the different contributing packages is important so R3 requires a particular combination of these 3rd party packages. We’ve mirrored these downloads so that you don’t have to try and find them. These links and links to the packages home web pages are included below. Limitations: Displaying an interactive figure (i.e., using Matplotlib's show() command) is a blocking command and Vizard will halt until the window is closed. Saving figures to the disk does not have this problem, and raster formats can be read from disk and then displayed as textures if needed for certain scenarios. Installing
Configuring You need to modify lines 29 & 30 in the file called “matplotlibrc”, which is found in the Vizard30\bin\lib\site-packages\matplotlib\mpl-data folder. Change them to read: Code:
backend : WXAgg numerix : numpy # numpy, Numeric or numarray Restart Vizard, and then paste the following into an empty Vizard script window and run: Code:
from pylab import * t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) plot(t, s, linewidth=1.0) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) show() Matplotlib Matplotlib’s homepage Useful tutorial More examples NumPy NumPy’s homepage Users guide |
#2
|
|||
|
|||
Hi,
I have downloaded and installed numpy, wxPython and matplotlib, but when I run your example code, I keep getting the following error message: Quote:
Any help would be much appreciated. Best wishes, Catherine. |
#3
|
|||
|
|||
Is your matplotlib folder in Vizard's site-packages folder?
|
#4
|
|||
|
|||
Yes. the matplotlib folder is in Vizard;s site-packages folder.
Thanks, Catherine. |
#5
|
|||
|
|||
Error Message
Attached is the error I get when I run the pylab source file in case this helps.
Many thanks, Catherine. |
#6
|
|||
|
|||
Just a guess, but try re-installing numpy as a module in that package is not right according to the screenshot you posted.
__________________
Paul Elliott WorldViz LLC |
#7
|
|||
|
|||
I've tried re-installing everything and I am still getting the error:
Quote:
Many thanks, Catherine. |
#8
|
|||
|
|||
Try un-installing all those packages through Windows add/remove programs. Then download and run these more recent installers.
matplotlib-0.98.3.win32-py2.4.exe numpy-1.2.1-win32-superpack-python2.4.exe wxPython2.8-win32-ansi-2.8.9.2-py24.exe Make sure they all find Vizard's python installation. Do you still have the same problem? |
#9
|
|||
|
|||
I have managed to get pylab working, which is great news, thanks for all of your help.
I am now trying to convert my MatLab code, which is: Quote:
Quote:
Quote:
Many thanks! |
|
|