相关疑难解决方法(0)

更改 matplotlib quiver 函数的箭头样式

有没有办法改变matplotlib quiver 函数的箭头样式?

我尝试将arrowprops=dict()kwarg传递给函数,但这似乎只适用于annotate function

无论如何,我正在寻找的箭头样式似乎没有包含在 matplotlib 中。我认为它们被称为“半箭”。我可以使用 UTF-8 字符插入这些箭头,但是无法自定义这些箭头,并且很难将它们正确对齐。有没有更好的方法来做到这一点(也许插入一个 SVG 符号)?

在此处输入图片说明

我上面的解决方案的代码:

import matplotlib.pyplot as plt
import numpy as np
import mplstereonet
import matplotlib.image as image

#UTF-8 characters don't seem to work in the normal pyplot backend
plt.switch_backend("gtk3cairo")

fig = plt.figure()
ax = fig.add_subplot(111, projection='stereonet')

arrows = [[120, 30, 120, 30, "sin"],
          [160, 50, 160, 50, "dex"]]

for arrow in arrows:
    strike = arrow[0] - 90
    ax.plane(strike, arrow[1], color="#000000")
    ax.line(arrow[3], arrow[2], color="#ff0000")

    x, …
Run Code Online (Sandbox Code Playgroud)

matplotlib

5
推荐指数
1
解决办法
3058
查看次数

如何在matplotlib中更改双头注释的头大小?

下图显示了哪个箭头很小的图... 在此处输入图片说明

我尝试了下面的代码,但没有成功...它说“提高AttributeError('未知属性%s'%k)AttributeError:未知属性头宽” ...

xyfrom=[10,620]
xyto=[130,620]
ax.annotate("",xyfrom,xyto,arrowprops=dict(arrowstyle='<->',linewidth = 2,     headwidth=10,color = 'k'
))
ax.text((xyto[0]+xyfrom[0])/2-15,(xyto[1]+xyfrom[1])/2+10,"headwidth is too    small",fontsize=24)
Run Code Online (Sandbox Code Playgroud)

python matplotlib

4
推荐指数
2
解决办法
1977
查看次数

标签 统计

matplotlib ×2

python ×1