bar plot with trend line

Asked by Matlabbey on 9 Sep 2012
Latest activity Answered by Azzi Abdelmalek on 9 Sep 2012

hi all

i am trying to make a plot that looks like the following:

how to get trendline on two sets of data?

thank you!

0 Comments

Matlabbey

Products

No products are associated with this question.

2 Answers

Answer by Image Analyst on 9 Sep 2012
bar(x,y);
hold on;
plot(x,y, 'k-');

0 Comments

Image Analyst
Answer by Azzi Abdelmalek on 9 Sep 2012
x1=[1 3  5];x2=[2 4 6];
y1=[3  1  5];y2=[4  3  3]
bar_widh=0.2;
bar(x1,y1,bar_widh,'r');hold on; bar(x2,y2,bar_widh,'g')
hold on;plot(x1,y1,'b');hold on; plot(x2,y2,'m')

0 Comments

Azzi Abdelmalek

Contact us