0

I'm trying to show two graphs next to each other. pie char and bar char. my code is:

import matplotlib.pyplot as plt
fig , ax = plt.subplots(nrows = 1, ncols = 2)
df['column'].value_counts().plot.pie()
df['column'].value_counts().plot.bar()
plt.show() 

this is the output:

enter image description here

can someone help me please?

Anurag Dabas
  • 23,002
  • 8
  • 19
  • 34
bigish
  • 11
  • 1

1 Answers1

1

Pass the subplots to the plot commands:

fig , ax = plt.subplots(nrows = 1, ncols = 2)

df['column'].value_counts().plot.pie(ax=ax[0])
df['column'].value_counts().plot.bar(ax=ax[1])

plt.show() 
Quang Hoang
  • 131,600
  • 10
  • 43
  • 63