image thumbnail

MATLAB Plot Gallery - Area Plot

by

 

24 Feb 2012 (Updated )

Create an area plot

Area_Plot

This is an example of how to create an area plot in MATLAB®.

Read about the area function in the MATLAB documentation.

For more examples, go to MATLAB Plot Gallery

% Load population data
load PopulationAge years population groups

% Create the area plot using the area function
figure
area(years, population/1000000)
colormap winter

% Add a legend
legend(groups, 'Location', 'NorthWest')

% Add title and axis labels
title('US Population by Age (1860 - 2000)')
xlabel('Years')
ylabel('Population in Millions')

Contact us