I have drawn histogram of a diagnosis, which I modeled as poisson distribution in python. I need to reduce the width of rectangle in output graph.
I have written following line in python. I need to width reduction parameter to this code line.
fig = df['overall_diagnosis'].value_counts(normalize=True).plot(kind='bar',rot=0, color=['b', 'r'], alpha=0.5)
You are looking for matplotlib.pyplot.figure
. You can use it like this:
from matplotlib.pyplot import figure
figure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')
Here is a example of how to do it:
names = ['group_a', 'group_b', 'group_c']
values = [1, 10, 100]
plt.figure(1, figsize=(9, 3))
plt.subplot(131)
plt.bar(names, values)
plt.subplot(132)
plt.scatter(names, values)
plt.subplot(133)
plt.plot(names, values)
plt.suptitle('Categorical Plotting')
plt.show()