Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Single Trendline for multiple datasets
Replies: 3   Last Post: Jan 24, 2013 3:03 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 7,868
Registered: 6/7/07
Re: Single Trendline for multiple datasets
Posted: Jan 24, 2013 10:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.