Skip to content


Subversion checkout URL

You can clone with
Download ZIP


griddata: Allow for easy switching between interpolation mechanisms #1820

willfurnass opened this Issue · 2 comments

3 participants


Say one finds a pathological natural-neighbour griddata case that matplotlib.delaunay can't handle so installs natgrid, which can cope with your data but is pretty slow. Unfortunately if natgrid is importable then it will always be used in preference to the quicker matplotlib.delaunay. It would be great if there were a griddata argument for selecting matplotlib.delaunay or natgrid at runtime.

The interp keyword argument could be used for this purpose e.g.

  • nn - matplotlib.delaunay natural neighbour interpolation
  • linear - matplotlib.delaunay linear interpolation
  • natgrid - natural neighbour interpolation using natgrid (if installed)

Something that's worth considering is a failover mode where interpolation usig natgrid is attempted only if matplotlib.delaunay fails (with a KeyError (!)).


@ianthomas23 - thoughts? Could other options, such as scipy.spatial.Delaunay be used in a similar vein? Sadly I'm blissfully ignorant of this part of the library so can't really add anything meaningful here.


@WillFurnass : As discussed in issue #1809 and on the matplotlib-devel mailing list, we will be replacing the flaky matplotlib.delaunay algorithm with Qhull. I have working on it now. Once that is done, there will be no need to use natgrid so I will be completely removing the natgrid option from matplotlib (subject to agreement from other developers).

@pelson : Changing matplotlib.delaunay to use Qhull is equivalent to us duplicating a very small subset of scipy.spatial.Delaunay within matplotlib. This is better than us having an optional external dependency on a scipy module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.