def plot_save(path, figs=None, dpi=300):
try:
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
pp = PdfPages(path)
if figs is None:
figs = [plt.figure(n) for n in plt.get_fignums()]
for fig in figs:
fig.savefig(pp, format='pdf')
pp.close()
logger.info('Saved pdf figures to:%s' % str(path))
except Exception, e:
logger.error('Cannot save figures to pdf, error:%s' % str(e))
评论列表
文章目录