I am pretty new to using Matplotlib
I couldn't figure out how to apply the things I found to my own graph, so I decided to make my own post
I use this code to generate my bar chart:
p = (len(dfrapport.index))
p1 = p * 2.5
p2 = p * 1.5
height = dfrapport['aantal']
bars = dfrapport['soort']
y_pos = np.arange(len(bars))
plt.bar(y_pos, height, color = ['black', 'red','orange', 'yellow', 'green', 'blue', 'cyan'])
plt.title('Aantal noodstoppen per categorie')
plt.xlabel('categorieën')
plt.ylabel('aantal')
plt.tick_params(axis='x', which='major', labelsize=p2)
plt.xticks(y_pos, bars)
plt.show()
But I don't understand how to change the size of the plot?
because when I use plt.figure(figsize=(p1,p2))
I get an empty plot with the correct labels ( But it does apply the size to the piechart i create later? ) And the barchart i originally wanted to create has basic 1-8 labels.
I want to change the size based on the amount of bars are created because sometimes the data I use doesn't contain one of the categories.