This is not the first time I try to get this done correctly, hopefully it will be the last.

I do not like the indirect control of matplotlib’s imshow, so I resorted to using pcolormesh (similar for the slower pcolor). However, displaying the ticks in correct positions for a given dataset is not fully trivial, since pcolormesh interprets x and y data as boundaries for the plotted color cells. Thus the below.

download

download (2)