Plotting discontinuos X Data
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a data set that looks like this :
datax = [6 7 8 9 14 48 49 50 55 87 88 89];
datay = [1 1 1 1 2 3 3 3 4 5 5 5];
I want to make a single figure which will have essentially 5 lines corresponding to every jump in the x data. The first line will be ones reperesenting X index 1:4 i.e, 6,7,8,9 The second line will be a single point at 2 representing X index 5 i.e, 14 The third line will be threes representing X index 6:8 i.,e 48,49,50 and so on. Also the code should be extendable to any datax with discontinuities like shown above and produce a new line at every discontinuity.
0 Commenti
Risposta accettata
Mike Garrity
il 4 Gen 2016
datax = [6 7 8 9 nan 14 nan 48 49 50 55 nan 87 88 89];
datay = [1 1 1 1 nan 2 nan 3 3 3 4 nan 5 5 5];
plot(datax,datay,'-o')
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Line 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!