0
votes

I have a matrix for example A=rand(60,60). I want to set the x-axis and y-axis value with step size: 1:2:119 in 3d bar (matlab bar3). I already tried to make it but it doesn't work for large matrix. Note, y-axis is perfect but x-axis is not, it shows from 1 to 60. For example:

Z = rand(60,60);[r,c] = size(Z);
Y = 1:2:119; % y-axis value
X = 1:2:119;   % x-axis value
bar3(Y,Z); set(gca,'XTick', X)
1
Is bar3 an R function, or Matlab? - lawyeR

1 Answers

0
votes

See: xlim and ylim

Z = rand(60,60);
[r,c] = size(Z);
Y = 1:2:119; % y-axis value
X = 1:2:119; % x-axis value
bar3(Y,Z);

xlim([X(1), X(end)]);
set(gca,'XTick', X)

ylim([Y(1), Y(end)]);
set(gca,'YTick', Y)

Sample Plot

The ticks are super crowded but I'm just going with what you specified in your example.