How to set arbitrary colors for bars in a 3D bar plot?

前端 未结 3 426
渐次进展
渐次进展 2021-01-14 08:58

Say that I have a matrix Z with some values, and I want to illustrate it by a plotting the values in Z by height. The first solution comes to mind

3条回答
  •  遥遥无期
    2021-01-14 09:24

    While I find EBH's solution aesthetically more pleasing, here there is a simpler solution: interpolation

    z = peaks(5);
    [x,y]=meshgrid(1:0.1:size(z,1),1:0.1:size(z,2));
    zn=interp2(z,x,y,'nearest');
    % plot it
    surf(zn,'edgecolor','none','facecolor','interp')
    

提交回复
热议问题