image thumbnail

MATLAB Plot Gallery - Pie Chart 2D (1)



Create a simple pie chart


This is an example of how to create a simple pie chart in MATLAB®.

Read about the pie function in the MATLAB® documentation.

Go to MATLAB Plot Gallery

% Load the data for US population by age 1860-2000
load populationAge population groups

% Get the population for each age group for the year 2000
age2000 = population(15, :);

% Create a pie chart using the pie function -- use age groups as labels
pie(age2000, groups);

% Add title
title('US population by age for the year 2000');

Contact us