How to Create a seperate colormap for each pi-chart in a subplot
2 views (last 30 days)
Show older comments
if true
% code
labels={'A','B','C','D','E','F'};
data=[22,19,11,16,11,21]';
wedge=[0,0,0,0,0,1]';
figure
subplot(1,3,1);
pie(data,wedge,labels);
colormap([0,0,1;0,1,1;0,1,0;1,0,0;1,0,1;0,0,0]);
title('Raw Data')
subplot(1,3,2);
pie(data(1:end-1),labels(1:end-1));
% colormap([0,0,1;0,1,1;0,1,0;1,0,0;1,0,1]);
title('Data Excluding F');
subplot(1,3,3);
data2=[(data(1)+data(2)),data(3),(data(4)+data(5))]';
labels2={'A+B','C','D+E'};
pie(data2,labels2);
% colormap([0,0,1;0,1,1;0,1,0]);
title('Groups');
end
If only the the first colormap is run: </matlabcentral/answers/uploaded_files/133805/CM1.PNG> If the first line and second colormap is run, the second one applies the second colormap to the first subplots: </matlabcentral/answers/uploaded_files/133806/CM2.PNG> If the first line second and third colormap is run, the third one applies the second colormap to the first and second subplots: </matlabcentral/answers/uploaded_files/133807/CM3.PNG>
How can I specify an individual colormap for each subplot?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!