image thumbnail

MATLAB Plot Gallery - Pie Chart 2D (1)

by

 

24 Feb 2012 (Updated )

Create a simple pie chart

Pie_Chart_2D_1

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

Read about the pie function in the MATLAB documentation.

For more examples, 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
figure
pie(age2000, groups)

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

Contact us