Question

I want to superimpose a line on top of a spectrogram (plotted using imagesc). I am unable to do this using the "hold on" command. I also want to show a y scale for the line that I am plotting over the spectrogram. (Note: Spectrogram already shows a yscale of frequency values on the left hand side of the plot, I want yscale for the new line to show up on the right hand side)

MATLAB's online documentation shows a way to plot to functions in a single figure with two y axes... but this doesnt seem to work with imagesc http://www.mathworks.com/help/matlab/ref/plotyy.html

Was it helpful?

Solution

Just use hold on... here's an example:

% generate some figure;
imagesc(); 
hold on
x=1:0.1:70; % just some vector that fits the size of imagesc
plot(x,35+10*sin(x),'k'); 

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top