首页 > 解决方案 > Matplotlib 仅在身体上注释虚线花式箭头,而不是头部

问题描述

以下代码生成带有虚线轮廓线的箭头。我想保持两个头之间的界线是虚线,但不是我想明确的头周围的界线。

实际上,如果线条和补丁颜色相同,则箭头的头部是锯齿状的。

我真的不知道从哪里开始。

import matplotlib.pyplot as plt
plt.figure()
ax = plt.gca()
ax.annotate("", xy = (0.2,0.2), xytext = (0.8,0.8), arrowprops = dict(arrowstyle="<|-|>", shrinkA = 0, shrinkB = 0, linestyle = '--', mutation_scale = 30))
ax.annotate("", xy = (0.2,0.3), xytext = (0.9,0.8), arrowprops = dict(arrowstyle="<|-|>", shrinkA = 0, shrinkB = 0, linestyle = '--', mutation_scale = 30, color = 'r', linewidth = 2))
plt.show()

在此处输入图像描述

标签: pythonmatplotlibannotate

解决方案


推荐阅读