A Problem with bar3 Function

I used bar3 function to generate the following figure, but I do not know how to set Y label correctly in my code. In each grid, Y label should be 0.3,0.4,0.5,0.6,0.7,0.8. The code that I use is in the commitment below. I would appreciate if you could help me. Thanks.

2 个评论

It seems your Y-axis already shows those values. Could you please paste the code?
Here is the code I use, I really do not understand where the problem is. I would appreciate if you could help me.
function Plot_4D_bar(Z,grid_cell,x_cell,y_cell,xlab,ylab,zlab)
%grid_cell is the names of the grids here it is grid_cell={'grid1','grid2','grid3'}
%y_cell is obtained in the following way
%y=[0.3,0.4,0.5,0.6,0.7,0.8]; y_cell=num2cell(y);
%num_grid is number of grids
num_grid=size(grid_cell,2);
%length_grid is the length of the grids
length_grid=size(Z,1)/num_grid;
Y=1:size(Z,1)+num_grid-1;
Y(find(mod(Y,length_grid+1)==0))=[];
bar3(Y,Z)
view(-70,30)
a=2;
for i=1:size(grid_cell,2)
text(-2,a,grid_cell{1,i});
a=length_grid+1+a;
end
set(gca,'YTickLabel',y_cell);
set(gca,'XTickLabel',x_cell);
xlabel(xlab);
ylabel(ylab);
zlabel(zlab);
end

请先登录,再进行评论。

回答(1 个)

Are you trying to make 3 independent graphs on the same figure?
Are you familiar with subplot()? That would give you more control over the separate axes.
subplot(1,3,1)
bar3(y,ones(size(y)))
view(-70,30)
ylabel('grid 1')
subplot(1,3,2)
bar3(y,1:1:6)
view(-70,30)
ylabel('grid 2')
subplot(1,3,3)
bar3(y,6:-1:1)
view(-70,30)
ylabel('grid 3')

1 个评论

may
may 2013-10-11
编辑:may 2013-10-15
Thanks. Since the number of grids is around 10 in some cases using subplot, the figures are not clear.

请先登录,再进行评论。

产品

标签

提问:

may
2013-10-11

评论:

may
2013-10-11

Community Treasure Hunt

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

Start Hunting!

Translated by