Clear Filters
Clear Filters

How to use bar function

3 views (last 30 days)
Tran Hoa
Tran Hoa on 3 Nov 2018
Commented: madhan ravi on 3 Nov 2018
Hi members.For example I have a=[1 2], b=[3 4]. I want to compare two values, and I use bar function. But, I do not know how to combine two values in a plot, print like this figure (Element 9, and 10). Can you help me. Thank you

Accepted Answer

madhan ravi
madhan ravi on 3 Nov 2018
An example:
y = [75 91 105 123.5 131 150 179 203 226 249 281.5];
bar(y,0.4,'b')
hold on
y1=[75.1 125]
bar([2.5 3.5],y1,0.4,'m')
legend({'1st bar','2nd bar'})
  2 Comments
Tran Hoa
Tran Hoa on 3 Nov 2018
Thank you very much.
madhan ravi
madhan ravi on 3 Nov 2018
Anytime :)

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Programming 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!