Change colour in stem plot, for only particuar values
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nikolas Spiliopoulos
am 29 Mai 2020
Kommentiert: Nikolas Spiliopoulos
am 30 Mai 2020
Hi all,
I have a vector that I need to create a stem plot.
However, i would like to put a different colour to the 4th and 9th element
Could you hekp me with that?
I saw some similar questions but I don't really understand how to do it
thanks a lot!
0 Kommentare
Akzeptierte Antwort
Tommy
am 29 Mai 2020
You could overlay two separate stem plots:
data = randi(10,10,1);
idx = [4, 9];
ax = axes;
hold(ax, 'on');
temp = data; temp(idx) = NaN;
stem(ax, temp, 'b');
temp = nan(size(data)); temp(idx) = data(idx);
stem(ax, temp, 'g');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!