gpt4 book ai didi

Matlab 问题 : fixing the scale of Y axis in hist

转载 作者:行者123 更新时间:2023-12-04 06:20:19 24 4
gpt4 key购买 nike

我想绘制几个直方图。但是我希望 Y 轴是固定的,比如从 1000 到 1 乘以 100。我该如何指定它们。

请指教。

最佳答案

考虑这个例子:

%# some data
X = randn(1000,3);
nbins = 10;

%# compute frequencies and bins
%#[count,bins] = hist(X, nbins);
count = zeros(10,size(X,2));
bins = zeros(10,size(X,2));
for i=1:size(X,2)
[count(:,i),bins(:,i)] = hist(X(:,i),nbins);
end

%# show histograms
for i=1:size(X,2)
subplot(1,size(X,2),i)
bar(bins(:,i), count(:,i),'hist')
set(gca, 'YTick',0:100:4000, 'YLim',[0 400])
end

enter image description here

关于Matlab 问题 : fixing the scale of Y axis in hist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6668486/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com