【Py】matplotlib 使用指南

BacktoPython Index

import

from matplotlib import pyplot as plt
plt.switch_backend('agg')

plot and save

frame = plt.gca()
plt.imshow(data)
#plt.colorbar() 
frame.axes.get_yaxis().set_visible(False)
frame.axes.get_xaxis().set_visible(False)
frame.spines['top'].set_visible(False) 
frame.spines['bottom'].set_visible(False) 
frame.spines['left'].set_visible(False) 
frame.spines['right'].set_visible(False) 
plt.savefig('filename'+'.extension',\
    bbox_inches='tight',pad_inches=0,dpi=150)
plt.close()

convert image between cv2 & plt

猜你喜欢

转载自blog.csdn.net/baishuo8/article/details/88722462