1. You will need to import numpy and matplotlib
import matplotlib.pyplot as plt #python plotting library
import numpy as np #numpy library
2. you need to make a numpy array to use as a 2D map array
gMap = np.zeros((gWidth,gHeight)) # zero out map initially
gWidth and gHeight are dimensions of the array
3. You can access the numpy array as you would expect, e.g.
gMap[ix][iy] = gMap[ix][iy] +1
where ix and iy are the two integer indices
4. In the shutdown callback, you can plot the map as follows
plt.pcolor(gMap)
plt.show()
This will bring up a dialog box with a false color image of the map. There is a button on the dialog box to save the image
if you want. You need to kill the dialog box before the program will end.