How can I assign different color to the individual bars in the bar3 plot?

조회 수: 6 (최근 30일)
Zubair Nizamani
Zubair Nizamani 2016년 11월 21일
답변: KSSV 2016년 11월 21일
I am a beginner and I want to plot the bar3 plot to assign different individual color to the bars. As I followed the MATlab example with a little modification;
z=rand(5,5);
dist = 5:10:50;
b= bar3(dist,z);
for k = 1:length(b)
zdata = b(k).ZData;
b(k).CData = zdata;
b(k).FaceColor='interp'
end
set(gca,'XTickLabel',{4.5:0.5:7}) ;
xlabel({'lat'});
ylabel({'Distance(km)'});
zlabel({'Contribution'});
I know above code is wrong because I have used interp function, just to do interpolation in a same bar but I want to assign different color to the each bar.
Please,
regards, Zubair

답변 (1개)

KSSV
KSSV 2016년 11월 21일

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by