Given a list of irregularly spaced data points that are used to describe a line or curve or some noisy function, I would like to convert the data to an image-like numpy array, where each "pixel" either contains data or not (say, 1/0 for data / no data). A similar question was asked here; however, I do not necessarily have a data point for each possible x position, and my points are not necessarily integer values.
For example, say I wanted my output image array to span -10 <= x <= 30, 0 <= y <= 20 with each element in the array spanning 1 distance unit (image array would be 20x40). I have data points [(0.1, 0), (20, 5), (23.5, 18)] that I want to "plot". I would like to find all elements in the array that fall on the line segments created by connecting these points, and populate the array by setting these elements equal to 1 and the rest equal to 0.
EDIT: This is a start, but it seems to convert an entire plot into an image, not just the data (so, it includes axes, labels, etc).