MATLAB: Plotyy with extra markers

plotyy

Hi all,
I have 2 signals, being plotted in a YY plot. Two peaks of each signal have to be marked with an star. I did this in this way:
subplot( 3,2,4 ), plotyy( freq, x1, freq, y2)
hold on
[ ~, h1, h2 ] = plotyy( freq, markers1, freq, markers2);
set( h1, 'linestyle', 'none', 'Marker', '*' );
set( h2, 'linestyle', 'none', 'Marker', '*' );
But it seems like it is not the best way to do this, I I move the graph in the plot, all markers and 1 signal moves. How can I mark the peaks in the signal itself, instead of holding the figure and plotting it on top?
Any help would be appreciated..

Best Answer

You can add the markers to the original 2 AXES objects created by PLOTYY:
subplot(3, 2, 4);
AxesH = plotyy(freq, x1, freq, y2);
hold('on');
line(freq, markers1, 'linestyle', 'none', 'Marker', '*', 'Parent', AxesH(1));
line(freq, markers2, 'linestyle', 'none', 'Marker', '*', 'Parent', AxesH(2));
You can use PLOT instead of LINE also.