Python绘制奥运五环旗
时间: 2024-06-05 08:04:43 浏览: 102
Python可以使用matplotlib库进行绘图,绘制奥运五环旗需要用到matplotlib提供的圆形绘图函数和颜色填充函数。以下是实现代码:
```python
import matplotlib.pyplot as plt
import numpy as np
# 设置画布大小
fig = plt.figure(figsize=(6, 6))
# 绘制五个圆形并填充对应颜色
x = np.array([0, 1, 2, 3, 4])
y = np.array([0, 0, 0, 0, 0])
colors = ["blue", "black", "red", "yellow", "green"]
sizes = [100, 100, 100, 100, 100]
plt.scatter(x, y, s=sizes, c=colors)
# 去掉坐标轴
plt.axis("off")
# 显示绘制结果
plt.show()
```
阅读全文