Pie chart color assignment
显示 更早的评论
I am trying to make a pie chart of two quantities. Using a colormap, I have assigned two different colours to each of the quantities – one is green and the other one red.
In one of the charts the first quantity is at 100%, while in the other chart the second quantity is at 100%. So one chart has to be entirely red, and the other one entirely green. However, both charts always appear with the same colour:

And here is what I am trying to obtain:

So what is wrong here and how can we fix the problem?
Here is my code:
subplot(211)
x=[1,0];
pie(x)
colormap([0 0.70 0; 1 0.1 0]);
subplot(212)
x=[0,1];
pie(x)
Any help is greatly appreciated.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Pie Charts 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!