python画图

matplot

在图片上overlay点或者线

import matplotlib.pyplot as plt
import matplotlib.patches as patches
fig, ax = plt.subplots(1)
ax.imshow(frame)
#overlay 矩阵
rect = patches.Rectangle( (offsetx, offsety), width, height)	#注意offsetx,offsety用小括号括起来表示为一个点
ax.add_patch(rect)
#overlay 散点
ax.scatter(xvec, yvec, c=’r’, s=40)	#overlay点集
#保存或者显示
plt.show()
#plt.savefig(figname+’.jpg’)
plt.close()

翻转图片

frame = cv2.imread('xxx.jpg')
frame = frame[:, ::-1, :]    #沿垂直线对称
frame = frame[::-1, :, :]    #沿水平线对称

画3D线

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection=’3d’)
ax.plot([x1, x2], [y1, y2], zs=[z1, z2])
plt.show()
原文地址:https://www.cnblogs.com/fariver/p/6511924.html