How to plot multiple qqplot (Observed vs. Simulations) on same single figure with same regression line?
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I would like to plot multiple qq-plot (Observed vs. Simulations) in a same plot with same regression line. Below is an example of my script:
A = Observed_data(:,1); B = Simulation_01(:,1); C = Simulation_02(:,1); %Three of the datasets have the same length with different max and min value.
%I did try to used 'hold on' to plot two qqplot together...but both of them displayed with different regression line.
figure; h1 = qqplot(A,B);hold on; h2 = qqplot(A,C);
How can I make these two qqplot to share with the same line?
Thanks!
0 个评论
采纳的回答
José-Luis
2012-10-29
You can't. Why would you want to do that? Even if you could, what would the meaning be? It's not a regression line. A straight line indicates that the two samples come from the same distribution. You are talking about making the distribution of the simulations equal. The only way that would happen is if they were identical. You could transform them to make them similar (e.g. boxcox()), but I doubt you'd make them identical.
更多回答(1 个)
Honey
2022-1-28
Hello,
I want to plot multiple qq-plot (Observed vs. Simulations) in a same plot with the same straight line which indicates the two samples come from the same distribution.
1 个评论
Karen Bozanian
2022-9-9
For everyone looking for a solution, here is what I did (assuming we are comparing the quantiles of a given dataset vs Law1 and the same dataset vs Law2) :
hold on;
qqplot(data,law1);set(gcf,'Visible','off');
ax1 = get(gca,'Children');x1 = get(ax1,'XData');y1 = get(ax1,'YData');
x1 = cell2mat(x1(1)); y1 = cell2mat(y1(1));
qqplot(data,law2);set(gcf,'Visible','off');
ax2 = get(gca,'Children');x2 = get(ax2,'XData');y2 = get(ax2,'YData');
x2 = cell2mat(x2(1)); y2 = cell2mat(y2(1));
hold off
%% This is the desired output
figure;hold on;plot(x1,x1,'k-');plot(x2,y2,'ro');plot(x1,y1,'b+');hold off;
legend({'data quantiles','Law1 quantiles','Law2 quantiles'},'Location','best');
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!