WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-01-2006, 10:49 PM
tobin tobin is offline
WorldViz Team Member
 
Join Date: Feb 2003
Posts: 251
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
  1. Download and install numpy-0.9.5.win32-py2.4.exe
  2. Download and install wxPython2.6-win32-ansi-2.6.3.3-py24.exe
  3. Download and install matplotlib-0.87.1.win32-py2.4.exe

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
Testing
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()
Going deeper:

Matplotlib
Matplotlib’s homepage
Useful tutorial
More examples

NumPy
NumPy’s homepage
Users guide
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:45 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC