[英]How to set x and y values for Bar3 plotting in Matlab?
I have a matrix for example A=rand(60,60). 我有一个矩阵,例如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).
我想在3d栏(matlab bar3)中设置步长为1:2:119的x轴和y轴值。 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:
注意,y轴是完美的,而x轴不是完美的,它显示的范围是1到60。
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
请参阅:
xlim
和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. 滴答声非常拥挤,但我只是按照您在示例中指定的内容进行操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.