# Display values instead of percentage in Plotly Pie chart

**URL:** <https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267>\
**Category:** 📊 Plotly Python\
**Created:** [April 23, 2020, 10:18am UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267 "2020-04-23T10:18:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![777rishi](https://avatars.discourse-cdn.com/v4/letter/7/df788c/32.png) [@777rishi](https://community.plotly.com/u/777rishi)\
**Post date:** [April 23, 2020, 10:18am UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267/1 "2020-04-23T10:18:49Z")

</div>

I want the values to be displayed in pie chart instead of the percentages, there is no property to display the numbers instead of the percentages. Please suggest.

![piechart](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/5/5a0f1dc5a74533f42f27e917cd76d20c7858d88d.png)

Sample code to generate the pie chart:

import plotly.express as px  
import pandas as pd  
def my\_view(request):  
BASE\_DIR = os.path.dirname(os.path.dirname(os.path.abspath( **file** )))  
a=os.path.join(BASE\_DIR, ‘db.sqlite3’)  
con = sqlite3.connect(a)  
cur = con.cursor()  
df = pd.read\_sql\_query(“SELECT \* from POL”, con)  
esd = df.groupby(‘ProjectStatus’, as\_index=False).agg({“ProjectID”: “count”})  
fig = px.pie(esd, values=Tasks, names=my\_labels, color\_discrete\_sequence=px.colors.sequential.Blugrn)  
graph = fig.to\_html(full\_html=False, default\_height=350, default\_width=500)  
context = {‘graph’: graph}  
response = render(request, ‘Home.html’, context)

```auto

```

---

<div class="post-metadata">

**Author:** ![joseph.damiba](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@joseph.damiba](https://community.plotly.com/u/joseph.damiba)\
**Post date:** [April 23, 2020, 11:19am UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267/2 "2020-04-23T11:19:33Z")

</div>

Hello, and welcome to the community forum.

In order to display raw values rather than percentages in pie charts, you can set the `textinfo` attribute to `value`. For example:

```auto
import plotly.express as px
# This dataframe has 244 lines, but 4 distinct values for `day`
df = px.data.tips()
fig = px.pie(df, values='tip', names='day')
fig.update_traces(textinfo='value')
fig.show()

```

 ![Screen Shot 2020-04-23 at 7.15.08 AM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/9/9d017668c20dedcaf5a2683e54a830050eea3421.jpeg)

Hope that helps!

---

<div class="post-metadata">

**Author:** ![777rishi](https://avatars.discourse-cdn.com/v4/letter/7/df788c/32.png) [@777rishi](https://community.plotly.com/u/777rishi)\
**Post date:** [April 23, 2020, 12:45pm UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267/3 "2020-04-23T12:45:04Z")

</div>

Simply great!! It worked…  
Didn’t find the update\_traces method in plotly’s documentation, could you please provide the URL for full documentation if possible.

---

<div class="post-metadata">

**Author:** ![joseph.damiba](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@joseph.damiba](https://community.plotly.com/u/joseph.damiba)\
**Post date:** [April 23, 2020, 12:56pm UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267/4 "2020-04-23T12:56:31Z")

</div>

Glad I could help you solve your issue. The documentation for the `update_traces` method is:

> **[Creating and Updating Figures](https://plotly.com/python/creating-and-updating-figures/#updating-traces)**
>
> Creating and Updating Figures with Plotly's Python graphing library

---

<div class="post-metadata">

**Author:** ![777rishi](https://avatars.discourse-cdn.com/v4/letter/7/df788c/32.png) [@777rishi](https://community.plotly.com/u/777rishi)\
**Post date:** [April 23, 2020, 1:06pm UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267/5 "2020-04-23T13:06:56Z")

</div>

Thanks, have a good day ahead!!

---

<div class="post-metadata">

**Author:** ![Cleverboy](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Cleverboy](https://community.plotly.com/u/Cleverboy)\
**Post date:** [November 11, 2021, 8:34am UTC](https://community.plotly.com/t/display-values-instead-of-percentage-in-plotly-pie-chart/38267/6 "2021-11-11T08:34:52Z")

</div>

I know we can add value+percent using textinfo but is it possible to add percent in brackets (e.g. : 52(31%))
