Generation

generate functionTue, 21 Mar 2023

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')

plt.plot(data.index, data['nutri'] - data['mineral'], color = 'red', linewidth = 2, label = 'difference') plt.xticks(data.index, data['year'], rotation = 90) plt.xlabel('Year') plt.ylabel('Profit') plt.legend() plt.show()

Questions about programming?Chat with your personal AI assistant