How Can I make a plot linear regression in a subplot ?

2 views (last 30 days)
I'm using the command "plotregression(targets,outputs)" to plot a linear regression.I have something like this:
But I want to put this figures in a subplot.How can I make this ?
because I've already tried to make:
subplot(2,1,1)
plotregression(x,y)
...
But the "plotregression" appears in different figures.Can anyone help me ?
Thanks

Answers (1)

Image Analyst
Image Analyst on 29 Sep 2013
You're probably calling "figure" in one or more places. Don't do that. Figures will be created if needed. If you called it after the first call to subplot, then the second subplot will show up on the second figure instead of the first. So the order is:
subplot(2,1,1);
% Plot the first graph.
subplot(2,1,2);
% Then plot the second graph.
  2 Comments
Image Analyst
Image Analyst on 16 Feb 2015
Corona's "Answer" moved here:
with eliminating 'figure' doesn't work yet! with plotregression(target1,output1,'name1',target2,output2,'name2'), it does work. but i don't wan't to use it. i must use by subplot. how one can help me?
Image Analyst
Image Analyst on 16 Feb 2015
Then you'll have to dig into plotregression() and see what it does. Add subplot() to it's code. I don't have that so I can't do it. But I imagine you'd take additional inputs that are the number of rows, number of columns, and the plot number. Then call subplot(). You have its source code, don't you? Can you do what I said? If not, post the function with the paper clip icon.

Sign in to comment.

Categories

Find more on Line Plots 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!