The other reason this can happen is if you mistakenly redefine plt.xticks
. For example, if you accidentally run:
plt.xticks = ([1,2,3,4], ['a','b','c','d']) #wrong format, uh oh
Now you've redefined plt.xticks
as a tuple variable. When you then go to call it the right way:
plt.xticks([1,2,3,4], ["a", "b", "c", "d"])
You'll get an error for trying to call a tuple. The easy solution is to restart your session fresh, or at least to reimport matplotlib.pyplot which should overwrite the mistaken variable you created.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…