I am working on a small project where I am given a 2D array of XYZ data. Something in this manner:
a = [[1,7,13,3,4],
[6,21,32,11,2]]
where x represents the column of the array, y represents the row of the array, and z represents the content of the array, which is the distance. What I am trying to accomplish is to use the 2d array and plot a depth image in RGB. To elaborate, the closer the distance (z) value, I want the point to be plotted as red. And as the distance (z) values increase, I want to plot it yellow, green or blue depending on how large the distance is.
I added a sample picture for better clarification.

I am trying to accomplish this in python. I tried researching into it, but most of the time I found how to extract XYZ data from a depth image or from a point cloud, instead of using XYZ data to plot a depth image.
Please let me know if this is possible or what python libraries are available to achieve this.
Thank you.
EDIT: I believe it might help noting that the 2D array consists of point cloud data generated by a rangefinder sensor. I want to be able to construct a still 2d image of the scanned area using the data points. I also want to make use of colormaps in order to allow me to visualize the depth of the image.


