我有矩阵A,我做了一个小图
A = rand(15,9);
h = bar(A);
现在我想根据下面定义的颜色图“ colorset”为每组条(A的每一行)着色
colorset = [0 0 1;...
1 0 0;...
0 1 0;...
0 0 0.172413793103448;...
1 0.103448275862069 0.724137931034483;...
1 0.827586206896552 0;...
0 0.344827586206897 0;...
0.517241379310345 0.517241379310345 1;...
0.620689655172414 0.310344827586207 0.275862068965517]
我尝试做类似的事情
set(get(h,'children'),'cdata', A );
colormap(colorset);
但没有运气
我认为这应该有所帮助:
for hi = 1:numel(h)
set(h(hi), 'FaceColor', colorset(hi,:))
end
之前(原色):
之后(新颜色):
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句