![stackedBar.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231668/stackedBar.png)
積み上げグラフのcolormapについて
16 次查看(过去 30 天)
显示 更早的评论
スクリプトから生成される積み上げグラフにて凡例数が多い場合、
色が被ってしまい各データがどの凡例を表しているか分かりづらくなります。
そこでcolormapをlinesからcolorcubeに変更して、表示色を増やすことは可能でしょうか。
0 个评论
采纳的回答
Akira Agata
2019-7-28
たとえば以下のような方法ではいかがでしょうか?
% 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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231668/stackedBar.png)
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!