I have following code to show stacked bar
handles = df.toPandas().set_index('x').T.plot(kind='bar', stacked=True, figsize=(11,11))
plt.legend(loc='best', title="Line", fontsize = 'small', framealpha=0)
plt.ylabel("'" + lineName + "'")
plt.show()
I want to reverse the order of legend I used handles=handles[::-1]
but I got an error.