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,866
  • 9
  • 21
  • 41
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
  • 146,074
  • 10
  • 56
  • 74