Add to this the code for generating a grid on the chart, as well as specifying the percentage difference directly on the chart bars plt.figure(figsize = (12, 4)) plt.bar(data.index, data['nutri'], color = 'darkblue', label = 'nutri') plt.bar(data.index, data['mineral'], color = 'brown', label = 'mineral')
if(data['nutri']>data['mineral']): plt.text(data['mineral'] - (data['nutri'] - data['mineral']), data.index, '{:.2f}%'.format(data['mineral'] - data['nutri']), color='white', ha="center", va='bottom') else: plt.text(data['mineral'] + (data['mineral'] - data['nutri']), data.index, '{:.2f}%'.format(data['mineral'] - data['nutri']), color='black', ha="center", va='bottom') plt.legend() plt.title('Nutri vs Mineral', size = 20) plt.xlabel('Country', size = 20) plt.ylabel('Percentage', size = 20) plt.show()