2017-10-25 9 views
0

の間に設定します。現在、XTicksラベルはバーと整列しません。私はそれらを調整する際に助けが必要です。次のように私のコードは次のとおりです。XTicksラベルをMatlabのヒストグラムプロット上の各バーと整列させ、間隔を

x = randi([0 253], 1, 100); 
figure; 
hist(x,7) 
set(gca,'XTickLabel',{'1,S', '2,TS', '3,H1', '4,H2', '5,H3', 
'6,H4','7,H5'}) 
xlabel('Category of Storm') 
ylabel('Number of Storm Occurrences') 

Unaligned Histogram Plot Link

答えて

0

そもそも正しい位置に目盛りを所望の数(および、それらにラベルを付ける):

x = randi([0 253], 1, 100); 
figure; 
hist(x,7) 
xlabel('Category of Storm') 
ylabel('Number of Storm Occurrences') 
%%% 
h = 253/7; 
xticks(h/2:h:253-h/2) 
%%% 
set(gca,'XTickLabel',{'1,S', '2,TS', '3,H1', '4,H2', '5,H3', '6,H4','7,H5'}) 

enter image description here

関連する問題