Black Lives Matter. Please consider donating to Black Girls Code today.

Customer X Axis labels

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',
    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']

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.