def _finalizeFigure(fig, ax, outFile=None, yFormat=None, sideLabel=False,
labelColor=None, transparent=False, openFile=False, closeFig=True):
if yFormat:
func = (lambda x, p: format(int(x), ',')) if yFormat == ',' else (lambda x, p: yFormat % x)
formatter = FuncFormatter(func)
ax.get_yaxis().set_major_formatter(formatter)
if sideLabel:
labelColor = labelColor or 'lightgrey'
# add the filename down the right side of the plot
fig.text(1, 0.5, sideLabel, color=labelColor, weight='ultralight', fontsize=7,
va='center', ha='right', rotation=270)
if outFile:
fig.savefig(outFile, bbox_inches='tight', transparent=transparent)
if closeFig:
plt.close(fig)
if openFile:
systemOpenFile(outFile)
评论列表
文章目录