matplotlib 绘制 矩形,圆形

import matplotlib.pyplot as plt
%matplotlib inline

fig = plt.figure()

ax = fig.add_subplot(111)



rect = plt.Rectangle((0.2,0.75), 0.4, 0.15, color = 'r', alpha = 0.3)#左下起点,长,宽,颜色,α

circ = plt.Circle((0.7,0.2), 0.15, color = 'b', alpha = 0.5)#圆心,半径,颜色,α

pgon = plt.Polygon([[0.15, 0.15], [0.35, 0.4], [0.2, 0.6]], color = 'g', alpha = 0.5 )

ax.add_patch(rect)

ax.add_patch(circ)

ax.add_patch(pgon)

 

你可能感兴趣的:(python)