# Pie

You can use **pie charts** when you want to show differences within groups based on one variable. If you have categorical data then using a pie chart is a good choice.

## The Method To Use <a href="#the-method-to-use" id="the-method-to-use"></a>

The method is `s.plt.pie()`

It must contain the following input variables:&#x20;

```python
order: int
names: str
values: str
data: Union[str, DataFrame, List[Dict]]
```

And accepts the following input variable as optional:

```python
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int] 
padding: Optional[List[int]]
option_modifications: Optional[Dict]
```

#### &#x20;Video demonstration of the Pie chart <a href="#video-demonstration-of-the-pie-chart" id="video-demonstration-of-the-pie-chart"></a>

{% embed url="<https://api.media.atlassian.com/file/34e9d5e7-d20d-44c5-9ede-7a4313f67bfa/artifact/video_1280.mp4/binary?client=acb7ab48-9de5-4698-bc3e-5e7ecb6bc0a7&collection=contentId-455442442&max-age=2592000&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhY2I3YWI0OC05ZGU1LTQ2OTgtYmMzZS01ZTdlY2I2YmMwYTciLCJhY2Nlc3MiOnsidXJuOmZpbGVzdG9yZTpjb2xsZWN0aW9uOmNvbnRlbnRJZC00NTU0NDI0NDIiOlsicmVhZCJdfSwiZXhwIjoxNjQ3NDMzOTQ0LCJuYmYiOjE2NDc0MzEwMDR9.8IiCVSBIeNdORRaO6MxTD1FF3C65UK-FupRetzDcTF0>" %}
Pie chart settings and usage.
{% endembed %}

## Examples <a href="#examples" id="examples"></a>

### 1. Default Configuration  <a href="#id-1.-default-configuration" id="id-1.-default-configuration"></a>

```python
data = [
    {'name': 'Matcha Latte', 'value': 78},
    {'name': 'Milk Tea', 'value': 17},
    {'name': 'Cheese Cocoa', 'value': 18},
    {'name': 'Walnut Brownie', 'value': 9},
]

s.plt.pie(
    data=data, names='name', values='value',
    order=0, rows_size=2, cols_size=12,
)
```

![The pie chart is in the default configuration.](https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2F8QdtcRPywSz8e7jWzRpF%2FPie.png?alt=media\&token=788d4944-5b1a-496d-b4c2-7002f129556e)

### 2. Customization And Context <a href="#id-2.-title-for-the-chart-and-changing-data" id="id-2.-title-for-the-chart-and-changing-data"></a>

```python
data = [
    {'name': 'Matcha Latte', 'value': 78},
    {'name': 'Milk Tea', 'value': 17},
    {'name': 'Cheese Cocoa', 'value': 18},
    {'name': 'Walnut Brownie', 'value': 9},
    {'name': 'Buckeye Brownie', 'value': 12},
]

s.plt.pie(
    data=data, names='name', values='value',
    order=0, rows_size=2, cols_size=6,
    padding='0,0,0,2', title='Breakfast Delivery Preferences',
)
```

![Note the space before the component using padding='0,0,0,2', and size with cols\_size=6.](https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FdVbLQbvTR8SizLNvLBiY%2FPie%20Configured.png?alt=media\&token=75bae068-9c86-4c2e-bdbe-7a29da053ca4)

{% hint style="info" %}

### Featured Content

[changing-the-menu-path](https://docs.shimoku.com/dev/building-web-app/menu/changing-the-menu-path "mention")\
The `menu_path` can be modified.<br>

[using-the-grid](https://docs.shimoku.com/dev/building-web-app/grid/using-the-grid "mention")

It is possible to use any number of rows.
{% endhint %}
