imshow displays the matrix relative to the column indices (x axis) and row indices (y axis). I would like the axis labels not to be indices, but an arbitrary index function.
eg. pitch determination
imshow(A, aspect='auto') where A.shape == (88200,8)
on the x axis, shows several ticks around [11000, 22000, ..., 88000] on the y axis, shows the frequency bit [0,1,2,3,4,5,6,7]
I want:
The x axis designation is normalized from samples to seconds. For a 2-second sound at a sampling frequency of 44.1 kHz, I want two ticks at [1,2] .
The y axis designation is a step as a note. I need the marks in the pitch note ['c', 'd', 'e', 'f', 'g', 'a', 'b'] .
perfectly:
imshow(A, ylabel=lambda i: freqs[i], xlabel=lambda j: j/44100)
matplotlib axis-labels
sam boosalis
source share