Azzera filtri
Azzera filtri

yyaxis plot joining start and end points with a straight line

3 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Rik
Rik il 27 Mar 2018
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;

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by