Change colour in stem plot, for only particuar values

1 回表示 (過去 30 日間)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020 年 5 月 29 日
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!

採用された回答

Tommy
Tommy 2020 年 5 月 29 日
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');
  1 件のコメント
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020 年 5 月 30 日
thanks a lot, that's what I was looking for.....!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by