Choosing color of bars in bar graph depending on value (not individual, but from colormap)
4 ビュー (過去 30 日間)
古いコメントを表示
Hello
I want to create a 2D- bar graph and Color the bars depending on their values in gray tones. That is what I have so far:
figure()
y = rand(10,1)*3-1.5;
x = linspace(start, end, size(y));
b=bar(x,y,1);
% Defining Colormap
cm=gray(size(y));
colormap(cm);
set(get(b,'children'),'cdata', y);
But this does not work. Neither:
set(get(b,'children'),'CData', y);
I am missing something. Any help?
MJ
4 件のコメント
Walter Roberson
2018 年 6 月 28 日
Please do not use "end" as a variable name; you will confuse us, you will confuse you, you will confuse MATLAB.
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!