|
本帖最后由 meatball1982 于 2016-10-18 10:23 编辑
更新: 2016年 10月 18日 星期二 10:23:02 CST
唉,让孩子仔细读程序,就是不看,只好自己又写一点。
- clear all
- clc
- % % 3D bar
- A(:,:,1)=[1 2;
- 2 4;
- 3 6;
- 4 8;
- 5 10;
- 6 12];
- A(:,:,2)=[1 3;
- 3 5;
- 5 7;
- 7 9;
- 9 11;
- 11 13];
- A(:,:,3)=[1.5 2.5;
- 2.5 4.5;
- 3.5 6.5;
- 4.5 8.5;
- 5.5 10.5;
- 6.5 12.5];
- n_group=3;
- mm_col=jet(n_group*2)
- hold on
- for i=1:n_group
- g = hgtransform('Matrix',makehgtform('translate',[0 i 0], ...
- 'xrotate',pi/2));
- va=squeeze(A(:,:,i));
- h=bar(va);
- h(1).FaceColor=mm_col(2*i-1,:);
- h(2).FaceColor=mm_col(2*i,:);
- h(1).Parent=g;
- h(2).Parent=g;
- max_val(i) = max(va(:));
- end
- set(gca,'SortMethod','depth')
- xlim([0 7])
- ylim([1 n_group])
- zlim([0 max(max_val)])
- view(3)
- axis([1 7 1 3.2 0 13])
- xlabel('I am x')
- ylabel('I am y')
- zlabel('I am z')
- box off
- view(-55,12)
复制代码
这次是每个bar有两组数据。
---------------------俺四华丽的分割线--------------------------------------
别人的问题,bar 不是bar3d。
一片一片的画
- clear all
- clc
- clf
- da=[554050367,900724277,1336325693.00000,1862007893.00000,2479497635.00000,3191211797.00000;
- 139121567,226617077,337332893,472422293,633612035,823318997;
- 35235917,57840977,87215243,124511993,171457985,230470097;
- 22745087,37547957,57142013,82680533,115890275,159188117;
- 15952367,26512277,40787693,59931893,85671635,120423797;
- 9110543,15396821,24315149,37018805,55234547,81379253;
- 6049727,10424117,16945853,26768213,41617955,63911957];
- n_group=7
- col_mm=jet(n_group);
- hold on
- for i=1:n_group
- g = hgtransform('Matrix',makehgtform('translate',[0 i 0], ...
- 'xrotate',pi/2));
- h = bar(da(i,:),'facecolor',col_mm(i,:));
- h.Parent = g;
- max_val(i) = max(da(i,:));
- end
- % Setup axes correctly
- set(gca,'SortMethod','depth')
- xlim([0 7])
- ylim([1 n_group])
- zlim([0 max(max_val)])
- view(3)
- xlabel('I am x')
- ylabel('I am y')
- zlabel('I am z')
- box off
- view(-130,20)
复制代码
|
|