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

def func(x, pos): # formatter function takes tick label and tick position s = '{:0,d}'.format(int(x)) return s import matplotlib.ticker as ticker formatter = ticker.FuncFormatter(func) # make formatter plt.gca().yaxis.set_major_formatter(formatter) # set formatter to needed axis

Questions about programming?Chat with your personal AI assistant