This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Add Legend to Pie Chart

This example shows how to add a legend to a pie chart that displays a description for each slice.

Define x and create a pie chart.

x = [1,2,3];

Specify the description for each pie slice in the cell array labels.

labels = {'Product A','Product B','Product C'};

Display a horizontal legend below the pie chart. Pass the descriptions contained in labels to the legend function. Set the legend's Location property to 'southoutside' and its Orientation property to 'horizontal'.


The graph contains a pie chart and a horizontal legend with descriptions for each pie slice.

See Also


Related Topics

Was this topic helpful?