Rearrange halves of yaxis in graph
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I need to rearrange my graph. I would like to rearrange the y axis so that, y for x=1.25 to 2.1 will be placed before the y values of x = 0 to 1.25. But there shouldn't be any change in the xaxis. I don't think I can use 'fliplr' for this. But I am not able to figure out the code to do this through indexing.
Pls help me.
0 commentaires
Réponse acceptée
Adam Danz
le 24 Avr 2019
Modifié(e) : Adam Danz
le 24 Avr 2019
If I understand correctly, move the section of data from x=1.25 to x=2.1 and place that segment just before x=0.
Assuming you have two variables x & y that were used to plot your data: plot(x,y),
segmentStart = 1.25;
segmentStop = 2.1;
placeBefore = 0;
newIdx = [...
find(x<min(placeBefore, segmentStart)), ... %index values prior to insertion point
find(x>=segmentStart & x<=segmentStop), ... %index values of segment to be moved
find(x>=0 & x<segmentStart), ... %index values of section between insertion point and start of segement
find(x>segmentStop),... %indes values following the segment
];
plot(x, y(newIdx))
Voir également
Catégories
En savoir plus sur Graphics Object Programming dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!