0

I'm using the data frame plot function to create the following plot: Using the following code:

data.groupby(['age']).agg(np.size)['listener_id'].plot(kind='bar')

enter image description here

How can I save this plot?

HimanAB
  • 2,443
  • 8
  • 29
  • 43

2 Answers2

0

The pandas plotting function wraps matplotlib. You can save these using something like

plt.savefig('<filename>.png')

Demetri Pananos
  • 6,770
  • 9
  • 42
  • 73
0

Try this:

bplot = data.groupby(['age']).agg(np.size)['listener_id'].plot(kind='bar')
fig = bplot.get_figure()
fig.savefig("test.png")
sP_
  • 1,738
  • 2
  • 15
  • 29