注釈(matplotlib
)の矢印の頭を変更したいが、shrink
のような他のプロパティと共に使用すると機能しない。パラメータセットを調べることで、作成されるオブジェクトのタイプが変わるようです。matplotlib注釈の矢印の頭のスタイルを変更するにはどうすればよいですか?
例
次のコード注釈矢印の二つのタイプを示します。
import matplotlib.pyplot as plt
import numpy as np
xx = np.linspace(0,8)
yy = np.sin(xx)
fig, ax = plt.subplots(1,1, figsize=(8,5))
ax.plot(xx,yy)
ax.set_ylim([-2,2])
ax.annotate('local\nmax', xy=(np.pi/2, 1), xytext=(1,1.5), ha='center', \
arrowprops={'shrink':0.05})
ax.annotate('local\nmin', xy=(np.pi*3/2, -1), xytext=(5,0), ha='center', \
arrowprops={'arrowstyle':'->'})
通報
Iは、矢印が、このような最初の注釈の他の特性と共に入力設定しようとした:
ax.annotate('other\nmax', xy=(np.pi*5/2, 1), xytext=(7,1.5), ha='center', \
arrowprops={'arrowstyle':'->', 'shrink':0.05})
しかし、その行はエラーをスローする:
AttributeError: Unknown property shrink
なぜそれが機能しないのですか?
アノテーションの矢印の頭のスタイルを変更するにはどうすればよいですか?
私が使用しています:
のpython:3.4.3 + numpyの:1.11.0 + matplotlibの:1.5.1