'Matplotlib lables aren’t displaying
Hi i am trying to plot a graph with some information, the graph is plotted completely fine but I can’t get the labels to appear on the x and y axis. Would anyone know where I’ve went wrong?
with open(“student.txt”, “r”) as S:
contents = S.read()
amountWales = contents.count(‘Wales’)
amountScotland= contents.count(‘Scotland’)
amountEngland = contents.count(‘England’)
figure = plt.figure()
axis = figure.add_axes([0,0,1,1])
countries = [‘England’ ,’Scotland’, ‘Wales]
amountCountries = [amountEngland, amountScotland, anountWales]
axis.bar(countries, amountCountries)
plt.ylabel(‘Value’)
plt.xlabel(‘Country’)
plt.show()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
