本帖最后由 suchocolate 于 2021-11-1 21:07 编辑 #import numpy as np # 这行删除吧,没有用上。
import matplotlib.pyplot as plt
import matplotlib.patches as pat
fig, axs = plt.subplots(1, 2, sharex=False, sharey=False)
cic = pat.Circle((0, 0), 5, fill=False, color='b') # 圆心坐标0,0,半径5
axs[0].add_patch(cic)
axs[0].set_xlim(-5.5, 5.5)
axs[0].set_ylim(-5.5, 5.5)
xy = [[0, 5], [5, - pow(75, 0.5)], [-5, - pow(75, 0.5)]] # 三角形的三个顶点的坐标
tra = pat.Polygon(xy, True, fill=False, color='g')
axs[1].add_patch(tra)
axs[1].set_xlim(-5.5, 5.5)
axs[1].set_ylim(-10, 5.5)
plt.show()
|