1、绘制矩形
python matplotlib 绘制矩形,简单的几行代码就可以实现,简单易懂,方便利用。
# -*- coding: utf-8 -*-"""Created on Thu Aug 11 18:12:37 @author: Eddy_zheng"""import matplotlib.pyplot as pltimport matplotlib.patches as patchesfig1 = plt.figure()ax1 = fig1.add_subplot(111, aspect='equal')ax1.add_patch(patches.Rectangle((0.1, 0.1), # (x,y)0.5,# width0.5,# height))fig1.savefig('rect1.png', dpi=90, bbox_inches='tight')