# Create annotations above bar plot bars

**URL:** <https://community.plotly.com/t/create-annotations-above-bar-plot-bars/10897>\
**Category:** 📊 Plotly Python\
**Created:** [June 13, 2018, 6:31pm UTC](https://community.plotly.com/t/create-annotations-above-bar-plot-bars/10897 "2018-06-13T18:31:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alicyn](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@alicyn](https://community.plotly.com/u/alicyn)\
**Post date:** [June 13, 2018, 6:31pm UTC](https://community.plotly.com/t/create-annotations-above-bar-plot-bars/10897/1 "2018-06-13T18:31:16Z")

</div>

I’m generating a grouped bar chart and have text displaying within the bars. I figured out how to add annotations directly above each bar group (for each category on the x axis). However currently the annotation is displaying above the bar relative to the whole bar group - not the individual bars. As you can see I have 5 bars. How can I get the x position of each individual bar so that I can put the annotation in the right position?

I have a screenshot here to illustrate this.

![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/4/45c557662ccc7a925dee88c6a8908224e6c167a4.png)

This is the code that I have so far:

```
  #configure the layout
    layout = go.Layout(
            title=chart_title,
            annotations=[
                dict(
                    x=xpos,
                    y=float(ypos.strip('%')),
                    xref='x',
                    yref='y',
                    text=str(count),
                    showarrow=True,
                    arrowhead=1
                ) for xpos, ypos, count in zip(dates, percents_by_category, counts_list)
            ],
            yaxis=dict(
                title="My Title",
                ticksuffix="%"),
            xaxis=dict(
                title="Date"),
            barmode='group',
            plot_bgcolor='rgb(233,233,233)')

    fig = go.Figure(data=traces, layout=layout)
    plot(fig, filename='grouped-bar-chart')
```

---

<div class="post-metadata">

**Author:** ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)\
**Post date:** [June 19, 2018, 5:05pm UTC](https://community.plotly.com/t/create-annotations-above-bar-plot-bars/10897/2 "2018-06-19T17:05:51Z")

</div>

@alicyn Take a look at this tutorial: [https://plot.ly/python/text-and-annotations/](https://plot.ly/python/text-and-annotations/).
