積み上げグラフのcolormapについて

6 views (last 30 days)
Koki Hashiguchi
Koki Hashiguchi on 26 Jul 2019
Commented: Koki Hashiguchi on 29 Jul 2019
スクリプトから生成される積み上げグラフにて凡例数が多い場合、
色が被ってしまい各データがどの凡例を表しているか分かりづらくなります。
そこでcolormapをlinesからcolorcubeに変更して、表示色を増やすことは可能でしょうか。

Accepted Answer

Akira Agata
Akira Agata on 28 Jul 2019
たとえば以下のような方法ではいかがでしょうか?
% Sample data and color map
y = rand(3,10);
color = colorcube(size(y,2));
% Visualize the data
figure
h = bar(y,'stacked');
for kk = 1:numel(h)
h(kk).FaceColor = color(kk,:);
end
legend
stackedBar.png
  1 Comment
Koki Hashiguchi
Koki Hashiguchi on 29 Jul 2019
Akira Agata様
ご回答ありがとうございます。

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!