So I am trying to plot a bar graph of this dataframe, Teams consists of strings, Mentions consists of ints. Trying to plot Teams on x-axis, and Mentions on y-axis. But I am getting problems with the y-axis labels where the increments and labels are in decimals and I want them in integers/whole numbers:
top_5_teams = ['England', 'France', 'Ireland', 'Italy', 'Wales']
top_5_team_mentions = [20, 11, 13, 6, 11]
df4 = pd.DataFrame({"Team":top_5_teams,
'Number of Times Mentioned':top_5_team_mentions})
df4 = df4.sort_values("Number of Times Mentioned", ascending=False)
df4_team = df4.iloc[:,0]
df4_mentions = df4.iloc[:,1]
plt.bar(arange(len(df4_team)),df4_mentions)
plt.xticks(arange(len(df4_team)),team,rotation=30)
plt.show()
This is my graph: enter image description here
I would like to do it based on a variable such as arange() rather than a single number like 20 or 25 so my code can be used with any dataframe. So how can I change it so the intervals on the y-axis are integers/whole numbers rather than decimals/floats?