Plotting with Stem in different colours in 1 step
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!