Reputation: 85
I am creating subplots in pandas/jupyter notebook from the following dataframe
METHOD1 A B C D E
METHOD2
high 1410 14 426 13781 1
low 74142 303 757024 95105 37
medium 99174 670 277013 640000 127
mono 46599 207 405108 16793 160
axs = ct.plot(kind='barh', subplots=True, legend=False, figsize=(24,16))
for ax in axs:
ax.set_xscale('log')
In Jupyter I get one image with 4 subplots. I want to save that plot to one png, but
fig=axs.get_figure()
fig.savefig('plot.png')
gives an error message
AttributeError: 'numpy.ndarray' object has no attribute 'get_figure'
because axs is an array of the subplots I can save the individual subplots.
How can I save all the subplots to one image?
Upvotes: 6
Views: 4192
Reputation: 3306
Do axs[0].get_figure()
.
You are trying to call a matplotlib method on a numpy array.
Upvotes: 7