【问题标题】:Matplotlib Fancy arrow/Patch edge widthMatplotlib 花式箭头/补丁边缘宽度
【发布时间】:2019-03-21 14:45:40
【问题描述】:

以下代码将使用 matplotlib 生成一个精美的箭头:

import matplotlib.pyplot as plt

xy = [0.2,0.2]
xytext =[0.5,0.5]

plt.figure()
ax = plt.gca()
ax.annotate("", xy=xy, xytext=xytext,arrowprops=dict(arrowstyle="<|-", edgecolor = 'k', facecolor = 'r', shrinkA = 0, shrinkB = 0))

箭头是红色的,边缘是黑色的。如何控制黑边的宽度?

【问题讨论】:

    标签: python matplotlib


    【解决方案1】:

    您可以使用linewidth 参数。下面是一个例子

    import matplotlib.pyplot as plt
    
    xy = [0.2,0.2]
    xytext =[0.5,0.5]
    
    plt.figure()
    ax = plt.gca()
    ax.annotate("Text", xy=xy, xytext=xytext, arrowprops=dict(arrowstyle="<|-, 
                head_width=2, head_length=2", edgecolor = 'k', facecolor = 'r',
                linewidth=4))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-29
      相关资源
      最近更新 更多