python绘制连串圆形
时间: 2023-06-29 15:13:36 浏览: 28
好的,我可以为您提供一个使用 Python 绘制连串圆形的示例代码,也需要使用到 matplotlib 库,请确保已经安装该库:
```python
import matplotlib.pyplot as plt
# 画出连串圆形
def draw_circles():
fig,axs = plt.subplots()
circle1 = plt.Circle((0, 0), 1, color='r', fill=False, lw=2)
circle2 = plt.Circle((2, 0), 1, color='g', fill=False, lw=2)
circle3 = plt.Circle((4, 0), 1, color='b', fill=False, lw=2)
circle4 = plt.Circle((6, 0), 1, color='y', fill=False, lw=2)
circle5 = plt.Circle((8, 0), 1, color='purple', fill=False, lw=2)
axs.set_aspect('equal')
axs.add_artist(circle1)
axs.add_artist(circle2)
axs.add_artist(circle3)
axs.add_artist(circle4)
axs.add_artist(circle5)
axs.axis('off')
plt.show()
# 调用函数画出连串圆形
draw_circles()
```
运行上述代码后,会弹出一个窗口显示绘制的连串圆形。您可以根据需要修改代码以实现更加个性化的连串圆形绘制。