Hi all,
I would like to plot the largest eigenvalue of an affine matrix over a grid.
I followed the hints available at
http://www.scipy.org/Cookbook/Matplotlib/mplot3D
I missed the hint "Note that not all examples on this page are up to
date, so some of them might not be working."
How can I fix the problem ?
Nils
python -i eigplot.py --verbose-helpful
matplotlib data path /usr/lib64/python2.4/site-packages/matplotlib/mpl-data
$HOME=/home/nwagner
CONFIGDIR=/home/nwagner/.matplotlib
loaded rc file /home/nwagner/.matplotlib/matplotlibrc
matplotlib version 0.90.1
verbose.level helpful
interactive is False
units is True
platform is linux2
numerix numpy 1.0.4.dev3875
font search path
['/usr/lib64/python2.4/site-packages/matplotlib/mpl-data/fonts/ttf',
'/usr/lib64/python2.4/site-packages/matplotlib/mpl-data/fonts/afm']
loaded ttfcache file /home/nwagner/.matplotlib/ttffont.cache
backend TkAgg version 8.4
Traceback (most recent call last):
File "eigplot.py", line 28, in ?
ax.contourf3D(X,Y,Z)
File "/usr/lib64/python2.4/site-packages/matplotlib/axes3d.py", line
590, in contourf3D
raise NotImplementedError("contourf3D is broken")
NotImplementedError: contourf3D is broken
from scipy import *
from symeig import symeig
import pylab as p
import matplotlib.axes3d as p3
def A(x):
""" Affine matrix """
tmp = A0+A1*x[0]+A2*x[1]
w = symeig(tmp,eigenvectors=0)
return w[-1]
A0 = array([[1.,0.],[0.,1.]])
A1 = array([[1.,0.],[0.,-1.]])
A2 = array([[0.,1.],[1.,0.]])
delta = 0.025
x = arange(-3.0, 3.0, delta)
y = arange(-3.0, 3.0, delta)
X,Y = meshgrid(x, y)
Z = zeros((len(x),len(y)),float)
for i in arange(0,len(x)):
for j in arange(0,len(y)):
Z[i,j] = A(array([x[i],y[j]]))
fig=p.figure()
ax = p3.Axes3D(fig)
ax.contourf3D(X,Y,Z)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel(r'$\lambda_{\max}$')
fig.add_axes(ax)
p.show()
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users