答案 0 :(得分:1)
示例解决了此处评论中提到的hlines的前台问题。
将所讨论的变体可视化:
使用以下代码创建:
data = [.82, .72, .6, .5, .45]
col = ['k', 'b', 'm', 'g', 'r']
fig, axs = plt.subplots(1, 3, figsize=(12, 4))
axs[0].set_title('Problem: hlines in foreround')
for d, c in zip(data, col):
axs[0].plot([0, d], c, lw=10)
for d in data:
axs[0].axhline(d, lw=5)
axs[1].set_title('Solution 1: zorder=0 for hlines')
for d, c in zip(data, col):
axs[1].plot([0, d], c, lw=10)
for d in data:
axs[1].axhline(d, lw=5, zorder=0)
axs[2].set_title('Solution 2: plot hlines first')
for d in data:
axs[2].axhline(d, lw=5)
for d, c in zip(data, col):
axs[2].plot([0, d], c, lw=10)
plt.tight_layout()
答案 1 :(得分:0)