How can I perform two-dimensional interpolation using scipy?
This Q&A is intended as a canonical(-ish) concerning two-dimensional (and multi-dimensional) interpolation using scipy. There are often questions concerning the basic syntax of various multidimensional interpolation methods, I hope to set these straight too.
I have a set of scattered two-dimensional data points, and I would like to plot them as a nice surface, preferably using something like contourf
or plot_surface
in matplotlib.pyplot
. How can I interpolate my two-dimensional or multidimensional data to a mesh using scipy?
I've found the scipy.interpolate
sub-package, but I keep getting errors when using interp2d
or bisplrep
or griddata
or RBFInterpolator
(or the older Rbf
). What is the proper syntax of these methods?