
Plotting a matrix of vector to the index with different makers for all vectors
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Oscar Schyns
le 24 Nov 2020
Réponse apportée : Ritvik Garg
le 15 Juin 2021
Hi MATLAB,
I am trying to plot all 10 vectors in Matrix X (10,51) with the index (range 1:51) on the X axis and the values for all 10 vectors on the Y axis.
I use this code: plot(X'),
I am trying to make the plot also clear in black and white but that has not succeeded yet. I understand there are only 4 types of line styles so I think I should work with markers. The goals is thus to have different markers for all 10 vectors and only showing them every 5 iterations/index (so on x axis = 5,10,15,20.....). Is there a way to do that in a clear way, without splitting the matrix in 10 different vectors and combining the plots (takes alot of time and I have many matrices with all different dimensions). A problem is that if I do split it in different vectors I also need to add [1:51] to all these vectors so that the plot function understand that I want the index on the x axis.
Thank you for your time,
Oscar
0 commentaires
Réponse acceptée
Ritvik Garg
le 15 Juin 2021
Hi Oscar,
Here’s an example of plotting a matrix with 5 different markers for 5 vectors each of length 20, marking at every 5th iteration.
a = rand(5,20);
p = plot(a');
set(p, {"Marker"}, {'+';'o';'*';'x';'v';}, 'MarkerIndices', 5:5:20);
legend;

Hope this helps.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations 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!