colormap doesn't work with bar plots in 2019a
13 次查看(过去 30 天)
显示 更早的评论
I have been changing the colormap in bar charts for decades. It doesn't seem to work now with bar charts in 2019a.
Previously all I had to do to change the colormap in an existing bar chart to copper: colormap copper
Now it does nothing.
0 个评论
采纳的回答
Cris LaPierre
2020-3-27
y = [1 3 5; 3 2 7; 3 4 2];
b = bar(y,'FaceColor',"flat");
for k = 1:size(y,2)
b(k).CData = k;
end
If I want to use a different colormap, I could do this.
colormap copper
y = [1 3 5; 3 2 7; 3 4 2];
b = bar(y,'FaceColor',"flat");
for k = 1:size(y,2)
b(k).CData = k;
end
2 个评论
KV
2024-2-9
I discovered this issue too today, working through some legacy code! This solution breaks a lot of older code that was used to produce plots.
Kind of silly and quite a pity now that it'll take a for loop with each bar command to change facecolors....
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!