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

 採用された回答

Akira Agata
Akira Agata 2019 年 7 月 28 日

1 投票

たとえば以下のような方法ではいかがでしょうか?
% 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 件のコメント

Koki Hashiguchi
Koki Hashiguchi 2019 年 7 月 29 日
Akira Agata様
ご回答ありがとうございます。

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で カラーマップ についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!