# 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.](/files/zxiCtuxWmcATLudAjn3F)

### 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.](/files/I4222vM0QFdEPbary8LD)

{% hint style="info" %}

### Featured Content

[Changing the Menu Path](/dev/building-web-app/menu/changing-the-menu-path.md)\
The `menu_path` can be modified.<br>

[Using the Grid](/dev/building-web-app/grid/using-the-grid.md)

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shimoku.com/dev/elements/charts/pie-charts/pie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
