# Customer X Axis labels

**URL:** <https://community.plotly.com/t/customer-x-axis-labels/15455>\
**Category:** 📊 Plotly Python\
**Created:** [November 8, 2018, 6:53pm UTC](https://community.plotly.com/t/customer-x-axis-labels/15455 "2018-11-08T18:53:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elsammons](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/elsammons/32/4697_2.png) [@elsammons](https://community.plotly.com/u/elsammons)\
**Post date:** [November 8, 2018, 6:53pm UTC](https://community.plotly.com/t/customer-x-axis-labels/15455/1 "2018-11-08T18:53:12Z")

</div>

I am trying to replace this portion of matplotlib code with plotly code and am so far not having any success.

`ax.set_xticklabels([f"{x.year}-{x.month}" for x in df1.index], rotation=40, ha='right')`

I have tried the following:

tick\_text = [f"{x.year}-{x.month}" for x in df1.index]

```
layout = go.Layout(
    title = 'Reported Issues by Month',
    xaxis = dict(
    title = 'Date',
    showticklabels=True,
    ticktext = tick_text
),

```

The resulting chart, using `ticktext` will show the proper dates when hovering over the rendered bars but the tick labels along the X-Axis appear only on every other bar and they while the first bar will show Feb 2018 on hover the X-Axis label shows Mar 2018. This leads to the final bar being blank and the the bar prior incorrectly showing Nov 2018 as the X-Axis label.

Using `tickvals` will add a label to each bar but the labels are off by one leaving the hover and labels to again not match and ultimately the last bar will have no X-Axis label.

`tick_text = ['2018-2', '2018-3', '2018-4', '2018-5', '2018-6', '2018-7', '2018-8', '2018-9', '2018-10', '2018-11']`

 ![42%20AM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/a/ae051a3ee1a067d9fbe189dfed61f129f4932ac0.png)

---

<div class="post-metadata">

**Author:** ![elsammons](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/elsammons/32/4697_2.png) [@elsammons](https://community.plotly.com/u/elsammons)\
**Post date:** [November 8, 2018, 7:17pm UTC](https://community.plotly.com/t/customer-x-axis-labels/15455/2 "2018-11-08T19:17:40Z")

</div>

I re-evaluated what I was doing and decided to try and simplify and I appear to have success.

`tickvals = df1.index` in the xaxis = dict() seems to do the job. The only thing I need to do now is play around with date formats.
