Matplotlib: Save figure as file from iPython notebook

Problem solved: add 'bbox_inches="tight" argument to savefig.

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_axes([1,1,1,1])
plt.plot([1,2])

savefig('test.png', bbox_inches="tight")

I don’t understand what’s happening here, but the file looks like the iPython notebook inline file now. Yay.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)