0

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)
YatShan
  • 425
  • 2
  • 8
  • 22

1 Answers1

1

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()
Jonathan Gagne
  • 4,241
  • 5
  • 18
  • 30
  • 1
    It gives empty white rectangle in return. Where do I have to pass my dataframe? – YatShan May 09 '19 at 01:40
  • 1
    I added an example from [Here](https://matplotlib.org/tutorials/introductory/pyplot.html) in order to show how to use it with 3 little graphs. – Jonathan Gagne May 09 '19 at 01:45