image thumbnail

MATLAB Plot Gallery - Pie Chart 2D (2)



Create an exploded pie chart


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

Read about the pie function in the MATLAB® documentation.

Go to MATLAB Plot Gallery

% Load the data for South American populations
load SouthAmericaPopulations populations countries;

% Calculate the total populations and percentage by country
total = sum(populations);
percent = populations/total;

% Create a pie chart with sections 3 and 6 exploded
explode = [0 0 1 0 0 1 0 0];
pie(percent, explode, countries);

% Add title
title('South American Population by Country');

Contact us