Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
dpb
Posts:
6,692
Registered:
6/7/07
|
|
Re: Single Trendline for multiple datasets
Posted:
Jan 24, 2013 10:47 AM
|
|
On 1/23/2013 4:58 PM, Charlotte wrote: ...
> ... - of course 'dpb' makes a good point as > after this code, I lose the different colours of the different datasets, > but his lsline suggestion didn't work -...
Of course it works... :)
Well, you have to do a few extra steps...try the following to see...
>> y=rand(5); % some random data >> h=plot(y(:),'*'); % plot the whole shmear to >> lsline % put on the trend line >> set(h,'ydata',[]) % leave only the line >> hold on % don't wipe it out w/ >> plot(y) % the data coming... >> xlim([1 5]) % set the axis limits >>
Of course, by now you could have just done the coefficients... :)
I wasn't thinking the trendline would also be in background color when the plot color was turned to background. Also note that lsline doesn't work on line plots--you have to use a marker or the internal logic will not find the data handles.
--
|
|
|
|