Plotting with Stem in different colours in 1 step
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Scatter Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!