pharshalp
pharshalp

Reputation: 55

MATLAB : plot a line on top of spectrogram and show a new yscale

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

Upvotes: 1

Views: 1945

Answers (1)

bla
bla

Reputation: 26069

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

Upvotes: 1

Related Questions