Plotting with Stem in different colours in 1 step
Afficher commentaires plus anciens
Currently i'm using stem to plot values ina graph within a loop:
...
for i = 1:n
for i2 = 1:m
val = bla bla
colour = obj.colours(i);
stem(index, val, colour);
index = index + 1;
end
end
In order to speed things up i want to collect the values and stem them in 1 go.
I'm having issues assigning the right colour as in the loop:
...
for i = 1:n
for i2 = 1:m
vals(index) = bla bla
colours(index) = obj.colours(i);
index = index + 1;
end
end
stem(1:index-1, vals, colours);
It doesn't work.
How can i do something like this:
stem(1:index-1, vals, ['r' 'r' 'g' .... ]);
Thanks
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Scatter Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!