Thank you Jason. That is very close to what I was looking for. I
turned off the fill. Is there a way to label each contour line? I'd
like to label the voltage gradient on the line like a topographic map.
-d
At 09:13 PM 6/4/2012, you wrote:
There are several things you could do:
Use the matplotlib contour functions directly, which do take matrices.
Define a function which returns the matrix value, given an x and y
Use interpolation to make the last point a little smarter.
Here's an example where I use scipy to interpolate values:
V = matrix([
[0.020, 0.020, 0.016, 0.014, 0.011, 0.011],
[0.021, 0.018, 0.016, 0.013, 0.010, 0.011],
[0.017, 0.015, 0.015, 0.012, 0.010, 0.011],
[0.013, 0.013, 0.011, 0.009, 0.007, 0.009],
[0.011, 0.010, 0.009, 0.007, 0.005, 0.007],
[0.010, 0.009, 0.009, 0.007, 0.005, 0.007]
])
from scipy.interpolate import interp2d
g=interp2d(range(V.nrows()), range(V.ncols()), V.numpy())
def f(x,y):
return g(x,y)[0]
contour_plot(f,(0,V.nrows()), (0,V.ncols()),plot_points=100, colorbar=True)
See http://aleph.sagemath.org/?q=99e63821-cafa-423f-ae8e-d94174a62a87
Thanks,
Jason
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org