相关疑难解决方法(0)

如何制作在matplotlib中循环的箭头?

在matplotlib中绘制一个循环回指向其原点的箭头的正确方法是什么?我试过了:

plt.figure()
plt.xlim([0, 1])
plt.ylim([0, 1])
plt.annotate("", xy=(0.6, 0.9),
             xycoords="figure fraction",
             xytext = (0.6, 0.8),
             textcoords="figure fraction",
             fontsize = 10, \
             color = "k",
             arrowprops=dict(edgecolor='black',
                             connectionstyle="angle,angleA=-180,angleB=45",
                             arrowstyle = '<|-',
                             facecolor="k",
                             linewidth=1,
                             shrinkA = 0,
                             shrinkB = 0))
plt.show()
Run Code Online (Sandbox Code Playgroud)

这没有给出正确的结果:

箭头

connectionstyle从这个页面很难理解这些论点(http://matplotlib.org/users/annotations_guide.html).

我正在寻找的是像这样这样:

循环箭头

更新:链接的答案没有显示如何使用plt.annotate其他功能我想使用.使用$\circlearrowleft$标记的提议不是一个真正的解决方案.

python matplotlib

10
推荐指数
2
解决办法
2320
查看次数

matplotlib:绘制看起来像pyplot.arrow的弯曲箭头?

我用pyplot.arrow它画一些直箭,例如,

import matplotlib.pyplot as plt
import numpy as np

v={}
for i in range (1,4):
    v[i]=np.array([np.cos(-2*np.pi/3*i),np.sin(-2*np.pi/3*i)])

plt.arrow(.85*(.05*v[2]+.95*v[1])[0],.85*(.05*v[2]+.95*v[1])[1],.85*.9*(v[2]-v[1])[0],.85*.9*(v[2]-v[1])[1],width=0,head_width=.03,head_length=.045,length_includes_head=True,color="black")
plt.arrow(.85*(.05*v[3]+.95*v[2])[0],.85*(.05*v[3]+.95*v[2])[1],.85*.9*(v[3]-v[2])[0],.85*.9*(v[3]-v[2])[1],width=0,head_width=.03,head_length=.045,length_includes_head=True,color="black")
plt.arrow(.85*(.05*v[1]+.95*v[3])[0],.85*(.05*v[1]+.95*v[3])[1],.85*.9*(v[1]-v[3])[0],.85*.9*(v[1]-v[3])[1],width=0,head_width=.03,head_length=.045,length_includes_head=True,color="black")

plt.axes().set_xlim(-.5,1)
plt.axes().set_ylim(-np.sqrt(3)/2,np.sqrt(3)/2)
plt.axes().set_aspect(1)
plt.show()
Run Code Online (Sandbox Code Playgroud)

现在我想绘制一些圆弧曲线而不是直线的箭头.我看到我可以用pyplot.annotate()patches.FancyArrowPatchconnectionstyle="arc3,rad=.5"左右这样做.

但是这些箭头看起来与pyplot.arrows 完全不同,并且不适合我的其他数字.我不知道我怎么能传递像connectionstylepyplot.arrow.有没有办法绘制看起来像我得到的弯曲箭头pyplot.arrow

python matplotlib

7
推荐指数
2
解决办法
5392
查看次数

标签 统计

matplotlib ×2

python ×2