December 2017
Intermediate to advanced
386 pages
10h 42m
English
One can see that the exact result is reproduced by all of the methods to some degree, but for this smooth function, the piecewise cubic interpolant gives the best results:
import matplotlib.pyplot as pltimport numpy as npmethods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos']# Fixing random state for reproducibilitynp.random.seed(19680801)grid = np.random.rand(4, 4)fig, axes = plt.subplots(3, 6, figsize=(12, 6), subplot_kw={'xticks': [], 'yticks': []})fig.subplots_adjust(hspace=0.3, wspace=0.05)for ax, interp_method in zip(axes.flat, methods): ax.imshow(grid, interpolation=interp_method, ...Read now
Unlock full access