フィルターのクリア

yyaxis plot joining start and end points with a straight line

3 ビュー (過去 30 日間)
Binay Chandra
Binay Chandra 2018 年 3 月 27 日
コメント済み: Binay Chandra 2018 年 3 月 27 日
Hi All, I am plotting two signals using yyaxis which has the same time span, but while plotting it is joining start and end points of both the signals with a straight line which is kind of strange behaviour. But for some of the channels it is plotting perfectly.
I tried with removing all nan values but no luck. Checked size of both the signals and all are same. I am not able to find any properties that might have been accidently set. Code snippet below,
yyaxis left;
cla(axesHome, 'reset');
plot(axesHome, time, singal_1, 'LineWidth',1.5); grid on;
yyaxis right;
plot(axesHome, time, signal_2, 'LineWidth',1.5); grid on;
Please help.

採用された回答

Rik
Rik 2018 年 3 月 27 日
Because I don't have your data I can't check this, but it might be the case that your data is not well-sorted, so plot results in an unexpected straight line. The code below should ensure this is not the case.
yyaxis left;
cla(axesHome, 'reset');
[temp_time,order]=sort(time);
plot(axesHome, temp_time, singal_1(order), 'LineWidth',1.5); grid on;
yyaxis right;
plot(axesHome, temp_time, signal_2(order), 'LineWidth',1.5); grid on;

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by