How to remove regression line from qqplot?
7 views (last 30 days)
Show older comments
Hello all, For some reason, i don't want the auto fitted line (red in the picture)in my Q-Q plot. Is there any function to turned it off? here is my code for the picture attached. Also, any thoughts on how to add the Confidence Intervals?
qqplot(obs_high,M1_high); hold on
plot([0 400], [0 400])
xlabel('Observed streamflow (m^3/sec)')
ylabel('simulated streamflow (m^3/sec)')
title('Model-1');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166359/image.png)
0 Comments
Accepted Answer
Star Strider
on 26 Jul 2017
Return a handle from your qqplot call, then find the line you want to remove, (experiment) and set its color to 'none'.
Example —
hqq = qqplot(obs_high,M1_high);
hqq(2).Color = 'none';
Note — I don’t know if the Line object referred to here as ‘hgg(2)’ is the one you want.
2 Comments
Star Strider
on 26 Jul 2017
Thank you. My pleasure.
The confidence intervals aren’t an option in qqplot itself, and I’m not certain how the quantiles or the regression line are calculated.
One option is to use fitlm to calculate the regression and the confidence intervals for the plot.
Example —
load gas
figure(1)
hqq = qqplot(price1);
XD = hqq(1).XData;
YD = hqq(1).YData;
mdl = fitlm(XD(:),YD(:));
[ypred,yci] = predict(mdl,XD(:));
figure(2)
plot(XD, YD, '+b')
hold on
plot(XD(:),ypred,'-r', XD(:),yci,'--r')
hold off
However, the regression line is different from that calculated by qqplot, at least with these data. Since I rarely use qqplot and am not certain how it works internally, you will probably need to ask MathWorks how best to calculate the regression line and confidence intervals.
More Answers (0)
See Also
Categories
Find more on Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!