MATLAB: Annotate a spectrogram/ plot. How

annotation;image segmentationlabelingspectrogramspeech

I would like to annotate a spectrogram/ plot. For example, if the sentence "I am a cat" was said, I want the spectrogram to be labelled accordingly. How do I do that?
Specifically, I have a 500 x 500 matrix. I make it into a heatmap by plotting
imagesc(A)
Now, say first 30 entries (along x axis) represented phenomena A, 31 – 70 represented B, etc. How do I align this text below the plot?

Best Answer

str = 'I am a cat' ;
strs = strsplit(str) ;
data = rand(500,500) ;
imagesc(data) ; colorbar ;
% position to write text
idx = [1 100 200 300] ;
idy = 540 ;
for i = 1:length(idx)
text(idx(i),idy,strs{i},'FontSize',14,'Color','k')
end