plotyy with extra markers

4 ビュー (過去 30 日間)
Sven Schoeberichts
Sven Schoeberichts 2011 年 11 月 2 日
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..

採用された回答

Jan
Jan 2011 年 11 月 2 日
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.
  1 件のコメント
Sven Schoeberichts
Sven Schoeberichts 2011 年 11 月 2 日
Brilliant!
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by