Friday, 5 August 2016

MATLAB Programming 50 - bar charts (Example)

Set the bar interior color and outline color using RGB triplets. Set the width of the bar outline



y = [75 91 105 123.5 131 150 179 203 226 249 281.5];
bar(y,'FaceColor',[0 .5 .5],'EdgeColor',[0 .9 .9],'LineWidth',1.5)


Create a bar graph with a three-column matrix input and return the three bar series objects. bar creates one bar series for each column in the matrix.


y = [2 4 6; 3 4 5];
b = bar(y);


Change properties for a specific bar series by indexing into the object array. For example, change properties of the bars representing the second column of y using b(2). Starting in R2014b, you can use dot notation to set properties. If you are using an earlier release, use the set function instead.


b(2).LineWidth = 2;
b(2).EdgeColor = 'red';




No comments:

Post a Comment