简体   繁体   中英

How to set x and y values for Bar3 plotting in Matlab?

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)

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)

样本图

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM