Interpolated heat map plot from discrete data points

I have a data set of discrete, sparse points (x, y, value). I'd like to plot the data so that every (x, y) coordinate is given a color based on interpolation between nearby data points.

data = np.array([
    [0, 0, 18.75],
    [0, 2, 0],
    [0, 4, 16],
    [0, 6, 2],
    [-4, 2, 18],
    [-4, 4, 35],
    [-4, 6, 32],
    [-4, 8, 15],
    [-4, 10, 28],
    [4, 0, 26],
    [4, 2, 30],
    [4, 4, 32],
    [4, 6, 35],
    [4, 8, 26.5],
])

I've tried using pcolormesh but it expects my C values are a 2D array. How can I achieve this?



Read more here: https://stackoverflow.com/questions/68473246/interpolated-heat-map-plot-from-discrete-data-points

Content Attribution

This content was originally published by rgov at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: