对于不同大小的阵列,将多个概率图(使用Matlab中的probplot)组合在一个图中



我试图在同一个图中获得多个概率图,但我无法做到这一点。你能在这方面提供帮助吗?这是我一直试图做的的示例代码

cmap=colormap(jet(10));
close;
for pp = 1:10
numelements = randi(10e4,1,1);    
data = rand(numelements,1)*2;    

figure(1);
h1 = probplot('lognormal',data,'noref');
set(h1(1),'marker','+','color',cmap(pp,:),'markersize',10);
hold on;

end

等一下在这里不管用。

您只想第一次创建图形,并获取已创建轴的句柄。随后,您需要告诉probplot使用相同的轴,例如

cmap=colormap(jet(10));
close;
h1 = nan(1,10);  % Preallocate a vector to store all the line handles
for pp = 1:10
numelements = randi(10e4,1,1);
data = rand(numelements,1)*2;
if pp == 1
figure(1);
h1(pp) = probplot('lognormal',data,'noref');
ha = get(h1(pp),'Parent'); % get the handle to the created axis
else
h1(pp) = probplot(ha,'lognormal',data,'noref'); % reuse the same axis
end
set(h1(pp),'marker','+','color',cmap(pp,:),'markersize',10);
hold on;  % This doesn't do anything and can be removed.
end

相关内容

  • 没有找到相关文章