Reputation: 2776
I just want to make a Histogram which I can make Abscissa personally.
import matplotlib.pyplot as plt
heros=['Mage','Priest','Warlock']
y=[0.1828, 0.1300, 0.0689]
x = range(len(heros))
plt.bar(range(len(y)), y,color=['g'],tick_label=heros)
plt.show()
But I got an error---- AttributeError: Unknown property tick_label
Upvotes: 1
Views: 8225
Reputation: 26757
You are likely using a fairly old (pre-November 2015) version of Matplotlib. The tick_label
argument was added to ax.bar
in 1.5.0 with this commit.
Update to a newer version (2.1 is release-candidate status right now!) or rewrite the ticks manually by modifying the axis's tick labels. 1.4 and earlier example here, excerpted below:
# Example data
people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
y_pos = np.arange(len(people))
performance = 3 + 10 * np.random.rand(len(people))
plt.barh(y_pos, performance, align='center', alpha=0.4)
plt.yticks(y_pos, people)
Upvotes: 2