Xplace_for_ICCAD/iccad2025.py

25 lines
667 B
Python
Raw Permalink Normal View History

2025-06-26 16:21:37 +08:00
import matplotlib.pyplot as plt
# 定义颜色列表(标签, R, G, B, Alpha)
colors = [
("Bin", 0.1, 0.1, 0.1, 1.0),
("Mov", 0.475, 0.706, 0.718, 0.8),
("Filler", 0.8, 0.8, 0.8, 0.8),
("Buffer", 0.65, 0.08, 0.9, 0.8),
("FF", 0.65, 0.9, 0.08, 0.7),
]
# 绘图
fig, ax = plt.subplots(figsize=(8, 2))
for i, (label, r, g, b, a) in enumerate(colors):
ax.add_patch(plt.Rectangle((i, 0), 1, 1, color=(r, g, b, a)))
ax.text(i + 0.5, -0.2, f"{label}\n({r:.2f}, {g:.2f}, {b:.2f}, {a:.2f})",
ha='center', va='top', fontsize=9)
# 设置轴
ax.set_xlim(0, len(colors))
ax.set_ylim(0, 1)
ax.axis('off')
plt.tight_layout()
plt.show()