XData and YData from area chart
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chad Greene
le 2 Nov 2021
Commenté : Star Strider
le 2 Nov 2021
I'm using the area function to create a stacked area chart of hundreds of time series. After plotting my data via
h = area(t,Y);
I'd like to access the coordinates of all of the filled areas using
h(1).XData
h(1).YData
however, I'm surprised to find that h.XData and h.YData return the input data I gave it (time,Y) rather than the coordinates of the plotted objects.
Is there a way to access the plotted coordinates of the filled objects?
0 commentaires
Réponse acceptée
Star Strider
le 2 Nov 2021
Add (cumsum) ‘Y’ row-wise to get the coordinates —
t = 1:10;
Y = randi(9, 10, 3)
Ycoordinates = cumsum(Y,2)
figure
h = area(t,Y);
grid
.
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical 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!