First value of xticklabels missing when plotting a pandas DataFrame

You should never set the labels without setting the tick positions as well. I.e. if you use ax.set_xticklabels you always need to use ax.set_ticks as well (or else, there might be exceptions to this, in which case you need to know exactly what you're doing).

Here:

ax.set_xticks(range(len(df)))
ax.set_xticklabels(df.season)

produces

enter image description here


I had the same problem doing a heatmap. i tried the above but it cut off the edge rows and columns of my heatmap.

i did this to solve

l_col_list = list(df.columns.values)
ax1.set_xticklabels(['']+l_col_list,fontsize=6)
ax1.set_yticklabels(['']+l_col_list,fontsize=6)