dataSample = reshape([36 2:21],3,7)';
figure
catStrArray = {'category1','category2','category3'};
catArray = categorical(catStrArray);
catArray = reordercats(catArray,catStrArray);
bar(catArray,dataSample')
nModel = size(dataSample,1);
nCat = size(dataSample,2);
xPosAmpl = 0.3682626-0.3298725*exp(-0.407004*(nModel-1));
xPosInc = 2*xPosAmpl/(nModel-1);
modelNames = [];
for idxModel=1:nModel
bar_xPos = 1:nCat;
if nModel~=1
bar_xPos = bar_xPos-xPosAmpl+(idxModel-1)*xPosInc;
end
text(bar_xPos,dataSample(idxModel,:),num2str(dataSample(idxModel,:)',...
'%0.0f'),'vert','bottom','horiz','center');
modelNames{idxModel}=sprintf('model%d',idxModel);
end
legend(modelNames)
0 件のコメント
サインインしてコメントする。