YatShan
YatShan

Reputation: 444

How to reduce the width of histogram?

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)

Upvotes: 0

Views: 482

Answers (1)

Jonathan Gagne
Jonathan Gagne

Reputation: 4389

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

Upvotes: 1

Related Questions