在Python中,可以使用matplotlb库中的Circle ()来画一个圆,然后通过将其封装并调用到plot_circle函数中来画一个圆。 该方法包括: 1、利用图形确定画布大小; 2、利用“Circle ()”配置有关圆的信息。
代码如下。 frommatplotlib.patchesimportellipse,Circle
import matplotlib.pyplot as plt
def plot_cicle () :
fig=plt.figure (
ax=fig.add_subplot(111 ) )
ci R1=circle (xy=(0.0,0.0 )、radius=2、alpha=0.5 ) ) ) ) ) ) ) )。
ax.add_patch(ciR1 ) ) ) ) ) ) ) ) ) )。
x,y=0,0
ax.plot(x,y,' ro ' ) )。
PLT.axis (已缩放) ) )。
PLT.axis(equal ) ) changeslimitsofxoryaxissothatequalincrementsofxandyhavethesamelength
plt.show () )
plot_cicle ()