ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 09 Jul 2012 07:58:42 -0500scipy.interpolate.interp2d multivariate interpolation and list alignementhttp://ask.sagemath.org/question/9143/scipyinterpolateinterp2d-multivariate-interpolation-and-list-alignement/Given a set of (x[i],y[i],Value[i]) we can create a list or tuple and plot them with the command list_plot3d. In this way we take a 3d plot where in fact the z-axis corresponds to the value of an f(x,y). Instead of doing this, it appears that with scipy.interpolate.interp2d it is possible to avoid using the list_plot3d and create a contour-density kind of plot. As shown in the [link](http://sage.math.canterbury.ac.nz/home/pub/189/) it is feasible to do this but the fact is that it is too complicated to understand for a beginner like me. Is possible to explain this just to the simple point that someone takes the tuple and tries to create a contour-like plot?
**EDIT:**
It seems that the part of the code below is enough to make a contour plot:
import numpy, scipy.interpolate
f_interpolation = scipy.interpolate.interp2d(*zip(*data))
plot_interpolation = contour_plot(lambda x,y:
f_interpolation(x,y)[0], (30,40), (20,30), cmap='jet', contours=numpy.arange(0.1,30,5), colorbar=True)
Notice on the second line that it refers to some data obviously given before this part of the code. I found out that for this code to work one has to have fully aligned data to feed to the code above.
Example:
( 37.850629, 5.421135, 22.162571637111411),
( 37.706629, 0.421472, 5.229876952864690),
( 7.706629, 28.421472, 15.229876952864690),
If in any way the data that might be a tuple, or a list from what i understand, are not formatted as above, the code doesn't run. **How is it possible to right align all elements as well as keep them aligned in relation to the decimal place in a list?**CosmosMon, 09 Jul 2012 07:58:42 -0500http://ask.sagemath.org/question/9143/