Given a list of points x_coords,y_coords
and a their corresponding values
, I want to rasterize it onto a 2D canvas
with these specific values
. Is there a python library to do this? As an attempt I was using PIL
, however, it only allows me to fill with a single value:
draw = ImageDraw.Draw(canvas)
draw.point([*zip(x_coords, y_coords)], fill=1)
# Ideally I want to fill it with specific values:
# draw.point([*zip(x_coords, y_coords)], fill=values)
sounds like exactly what you want,
scipy.interpolate.griddata
. example code included. basically you need: