# Reversed Data in Pie Chart

**URL:** <https://community.plotly.com/t/reversed-data-in-pie-chart/53569>\
**Category:** 📊 Plotly Python\
**Created:** [June 4, 2021, 9:22pm UTC](https://community.plotly.com/t/reversed-data-in-pie-chart/53569 "2021-06-04T21:22:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elcade](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/elcade/32/15272_2.png) [@elcade](https://community.plotly.com/u/elcade)\
**Post date:** [June 4, 2021, 9:22pm UTC](https://community.plotly.com/t/reversed-data-in-pie-chart/53569/1 "2021-06-04T21:22:07Z")

</div>

Hello Plotly friends, hope you an help me here 👋!

The data in the pie chart below is reversed for **Americas** and **EMEA** values, I have another pie chart with another column and works just fine, obviously I’m doing something wrong here but I can’t see it.

## **Thank you for your help!**

```auto
labels = df['Theater'].unique()
values = df['Theater'].value_counts()

```

```
customerTheaterFig = go.Figure(
data=[go.Pie(labels=labels, values=values, hole=.4)],
layout=dict(title=dict(text="<b>Customer Theater</b> (All)")))

customerTheaterFig.show()

```

 ![theater](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/a/a0098ed145f4698362aeceb9c5896bb39083fcc3.jpeg)

---

<div class="post-metadata">

**Author:** ![atharvakatre](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/atharvakatre/32/14713_2.png) [@atharvakatre](https://community.plotly.com/u/atharvakatre)\
**Post date:** [June 5, 2021, 4:48am UTC](https://community.plotly.com/t/reversed-data-in-pie-chart/53569/2 "2021-06-05T04:48:18Z")

</div>

The `value_counts()` method of pandas returns value in descending order, so the highest value (371) would be at the first position in your `values`. Whereas the labels are in the order as per the `df`.

Use can try this:

```auto
dff = df['Theater'].value_counts()

customerTheaterFig = go.Figure(
data=[go.Pie(labels=dff.index, values=dff.values, hole=.4)],
layout=dict(title=dict(text="<b>Customer Theater</b> (All)")))

customerTheaterFig.show()

```

---

<div class="post-metadata">

**Author:** ![elcade](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/elcade/32/15272_2.png) [@elcade](https://community.plotly.com/u/elcade)\
**Post date:** [June 5, 2021, 8:34pm UTC](https://community.plotly.com/t/reversed-data-in-pie-chart/53569/3 "2021-06-05T20:34:59Z")

</div>

Thank you so much @atharvakatre!  
I’ll try it out as soon as possible, I’ll reply here with updates.

---

<div class="post-metadata">

**Author:** ![elcade](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/elcade/32/15272_2.png) [@elcade](https://community.plotly.com/u/elcade)\
**Post date:** [June 7, 2021, 12:01pm UTC](https://community.plotly.com/t/reversed-data-in-pie-chart/53569/4 "2021-06-07T12:01:38Z")

</div>

Worked great!  
Thank you @atharvakatre!
