使用Python和matplotlib库
```python
import matplotlib.pyplot as plt
创建图形对象
fig, ax = plt.subplots()
绘制第一个圆形
circle1 = plt.Circle((0.2, 0.5), 0.1, color='r')
ax.add_artist(circle1)
绘制第二个圆形
circle2 = plt.Circle((0.5, 0.5), 0.2, color='g')
ax.add_artist(circle2)
绘制第三个圆形
circle3 = plt.Circle((0.8, 0.5), 0.15, color='b')
ax.add_artist(circle3)
设置图形的范围和坐标轴标签
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_aspect('equal')
ax.set_xlabel('X')
ax.set_ylabel('Y')
显示图形
plt.show()
```
使用Python和turtle库
```python
import turtle
创建画笔对象
t = turtle.Pen()
定义一个函数用于画圆
def draw_circle(x, y, r):
t.penup()
t.goto(x, y)
t.pendown()
t.circle(r)
画三个圆,分别指定不同的圆心坐标和半径
draw_circle(0, -100, 50)
draw_circle(-50, 0, 75)
draw_circle(50, 0, 100)
结束绘图
turtle.done()
```
使用Python和turtle库绘制三个彩色的同心圆
```python
import turtle
color = ['red', 'pink', 'green']
ra = [20, 50, 100]
for i in range(3):
t.pu()
t.goto(0, -ra[i])
t.pd()
t.pencolor(color[i])
t.circle(ra[i])
turtle.done()
```
这些示例代码分别展示了如何使用Python的matplotlib库、turtle库以及HTML5来绘制三个圆形图形。你可以根据自己的需求和编程环境选择合适的方法。