How to specify histogram's x and y axis

87 ビュー (過去 30 日間)
Al_G
Al_G 2020 年 1 月 7 日
回答済み: Al_G 2020 年 1 月 7 日
I have 2 subplots in a figure, both of them histograms.
1) I'd like the x-axis of the left subplot to go from 0 to 6 like the subplot on the right. I'm sure there's an easy way to do this, but setting the 'XTick' property didn't work.
2) I'd like to extend the y axis on both subplots to go up to 22, but again, manually setting 'YTick' doesn't do it.

採用された回答

the cyclist
the cyclist 2020 年 1 月 7 日
You can use the xlim and ylim commands.

その他の回答 (1 件)

Al_G
Al_G 2020 年 1 月 7 日
Figured it out for anyone trying to do the same: set the 'xlim' and 'ylim' property to your desired max and min values. This is how I did it for both subplots in one go:
ax = findobj(figure1,'Type','Axes');
for i = 1:length(ax)
ylim(ax(i),[0 22]);
xlim(ax(i),[0 6]);
end

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by