Good day. May I kindly ask anyone to look at the below script and associated Figure and advise on 1). How to manipulate the "Legend" so it doesnt Interfere/hide the time series. 2). Manage the colors of "time series" so they match thier "trend lines"
1 view (last 30 days)
Show older comments
figure clf plot(YEARS,S1(2:28,:),'linewidth',2.5) hold on plot(YEARS,S2(1:27,:),'r--','linewidth',2.5) hold on plot(YEARS,S1_trend(2:28,:),'linewidth',2) hold on plot(YEARS,S2_trend(1:27,:),'r--','linewidth',2) axis([1983 2009 -5 5]) h = legend('Ser1', 'Ser2','Ser1-trend','Ser2-trend')

0 Comments
Accepted Answer
Ingrid
on 5 Feb 2016
please use the documentation of the plot function to see how you can solve this
doc plot
but this is how you can do it
figure
clf
plot(YEARS,S1(2:28,:),'k''linewidth',2.5)
hold on
plot(YEARS,S2(1:27,:),'r','linewidth',2.5)
plot(YEARS,S1_trend(2:28,:),'k--','linewidth',2)
plot(YEARS,S2_trend(1:27,:),'r--','linewidth',2)
axis([1983 2009 -5 5])
h = legend('Ser1', 'Ser2','Ser1-trend','Ser2-trend')
set(h,'Location','EastOutside')
% chose the option that suits you best, for an overview type " doc legend" in the command window
More Answers (0)
See Also
Categories
Find more on Annotations 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!