How to change xticks on a histogram?
91 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I simply want to label the x axis of my histogram so every value is labelled. For example, the x tick labels are showing 2,4,6,8 etc automatically. I want it to do 1,2,3,4 etc. Here is the short code:
subplot(2,3,2)
a2= T2(:,8);
b2=table2array(a2);
histogram(b2, 'Facecolor', "k");
title('1980s');
xlabel('Frequency of drought');
ylabel('Number of sites');
j=gca
j.FontName='Times New Roman';
ylim ([0 50]);
0 件のコメント
採用された回答
Star Strider
2023 年 4 月 17 日
There are several ways to do this.
T2 = array2table(rand(100,10)*10); % Create Data
subplot(2,3,2)
a2= T2(:,8);
b2=table2array(a2);
histogram(b2, 'Facecolor', "k");
title('1980s');
xlabel('Frequency of drought');
ylabel('Number of sites');
j=gca
j.FontName='Times New Roman';
ylim ([0 50]);
xticks(1:10)
.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!