plotyy with extra markers

4 views (last 30 days)
Sven Schoeberichts
Sven Schoeberichts on 2 Nov 2011
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..

Accepted Answer

Jan
Jan on 2 Nov 2011
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.

More Answers (0)

Categories

Find more on Two y-axis in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!