Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab多条形图等高轴_Matlab - Fatal编程技术网

Matlab多条形图等高轴

Matlab多条形图等高轴,matlab,Matlab,我使用的方法,并试图使每一组酒吧有比例的高度。此方法将使.1高度的条看起来与另一垂直柱上的.5高度的条一样高。。。我曾尝试将“XLimMode”设置为手动,将“XLim”设置为常量,但不起作用 有人知道如何确保所有条形图的高度与相同的y轴(条形轴的高度)成比例吗?我找到了一个解决方案,首先找到所有值的最大值(totmaxes),然后在轴关闭之前添加一行 totmaxaxes = max(n(:)); % generate "data" m = rand( 40,10 ); [n x] = h

我使用的方法,并试图使每一组酒吧有比例的高度。此方法将使.1高度的条看起来与另一垂直柱上的.5高度的条一样高。。。我曾尝试将“XLimMode”设置为手动,将“XLim”设置为常量,但不起作用


有人知道如何确保所有条形图的高度与相同的y轴(条形轴的高度)成比例吗?

我找到了一个解决方案,首先找到所有值的最大值(
totmaxes
),然后在
轴关闭之前添加一行

totmaxaxes = max(n(:));

% generate "data"
m = rand( 40,10 ); 
[n x] = hist( m, 50 );

% the actual plotting
figure; 
ma = axes('Position',[.1 .1 .8 .8] );  % "parent" axes
N = size(n,2);  % number of vertical bars
for ii=1:N, 
   % create an axes inside the parent axes for the ii-the barh
   sa = axes('Position', [0.1+(ii-1)*.8/N, 0.1, .8/N, .8]); % position the ii-th barh
   barh( x, n(:,ii), 'Parent', sa); 
   set(sa, 'Xlim', [0,totmaxaxes + totmaxaxes/40])      %ADD THIS! (+ totmaxaxes/4 just assures that your bar doesn't hit the top)
   axis off;
end