I'm organizing data (x and y coordinates and a third value associated with each point). I'm able to plot everything and capture frames as the particles and create videos of their motion. Now I'm trying to create a grid where the third values in each cell are summed and then averaged. Then the grid cell should be coloured according to the mean value of the third value in the cell. Here's my code: I've made it up to the point where I can get the mean volume in each cell, but I'm not sure how to implement the colouring of the cells now. I'm using a fine grid and thousands of data points.
Any advice would be appreciated. Also, if you have suggestions on making my code better, or a better existing function, that would be great. Thanks.