Graphics |
Comparing Datasets with Area Graphs
Area graphs are useful for comparing different datasets. For example, given a vector containing sales figures,
and a vector containing profits figures for the same five-year period
display both as two separate area graphs within the same axes. Set the color of the area interior (FaceColor
), its edges (EdgeColor
), and the width of the edge lines (LineWidth
). See patch
for a complete list of properties.
area(x,sales,'FaceColor',[.5 .9 .6],... 'EdgeColor','b',... 'LineWidth',2) hold on area(x,profits,'FaceColor',[.9 .85 .7],... 'EdgeColor','y',... 'LineWidth',2) hold off
To annotate the graph, use the statements
set(gca,'XTick',[90:94]) set(gca,'Layer','top') gtext('\leftarrow Sales') gtext('Profits') gtext('Expenses') xlabel('Years','FontSize',14) ylabel('Expenses + Profits = Sales in 1,000''s','FontSize',14)
Area Graphs | Pie Charts |