FUNCTION REFERENCE

pie

Pie chart.

Pie chart.

Syntax

p = pie(x)

Syntax

p = pie(x, explode)

Syntax

p = pie(x, labels)

Syntax

p = pie(x, explode, labels)

Draws one slice per nonzero element of x, clockwise from 12 o'clock. When sum(x) is less than 1 the values are fractions and the pie is partial. Slices are labelled with their percentage (round(100*x/sum(x)), "< 1%" for tiny slices), inside the slice from 6 % up and outside below 6 %; labels is a cell array of texts used instead. Nonzero explode entries offset their slices. p holds a patch and a text handle per slice.

Example

p = pie([1 2 3 4]); numel(p)   % 8

Example

pie([0.2 0.3], [1 0], {'first', 'second'});

Differences from MATLAB: slice colours come from the plot palette, not the colormap. Labels are figure textboxes placed for the default figure size. The pie is drawn on Cartesian axes with the tick labels hidden.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.