複数の軸にまたがって伸びるテキストの矢印を描きたい。軸の外にテキストで矢印を描く
fig,ax = plt.subplots(2,3)
bbox_props = dict(boxstyle="rarrow,pad=0.2", fc="cyan", ec="b", lw=1)
t = ax[0,1].text(-0.8, 1.2, "Mag", ha="center", va="center", rotation=0, size=15, bbox=bbox_props)
私は幅と高さを有し、BBOXはRectangleの辞書であることtext docsから見つかったが、私を行いいる:http://matplotlib.org/users/annotations_guide.html
を読んで、私はこれまでということですセット
bbox_props = dict(boxstyle="rarrow,pad=0.2", fc="cyan", ec="b", lw=1, width=3)
t = ax[0,1].text(-0.8, 1.2, "Mag", ha="center", va="center", rotation=0, size=15, bbox=bbox_props)
は私が衝突を得る:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-255-006733283545> in <module>()
13 # properties of a rectangle : http://matplotlib.org/api/patches_api.html#matplotlib.patches.Rectangle
14
---> 15 t = ax[0,1].text(-0.8, 1.2, "Mag", ha="center", va="center", rotation=0, size=15, bbox=bbox_props)
16 plt.savefig('example.png', bbox_inches='tight')
/Users/chris/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_axes.py in text(self, x, y, s, fontdict, withdash, **kwargs)
626 if fontdict is not None:
627 t.update(fontdict)
--> 628 t.update(kwargs)
629
630 t.set_clip_path(self.patch)
/Users/chris/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in update(self, kwargs)
242 super(Text, self).update(kwargs)
243 if bbox:
--> 244 self.set_bbox(bbox) # depends on font properties
245
246 def __getstate__(self):
/Users/chris/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in set_bbox(self, rectprops)
514 bbox_transmuter=bbox_transmuter,
515 transform=mtransforms.IdentityTransform(),
--> 516 **props)
517 else:
518 self._bbox_patch = None
TypeError: __init__() got multiple values for argument 'width'
は、どのように私はBBOXと私の矢印の大きさを制御することができますか?それをすべて右に伸ばす方法はありますか?
ありがとうございました! クリス
ありがとう、テキストが矢印の中央にとどまるので、これは非常にきちんとした解決策であり、幅を簡単に制御できます。思ったより複雑ですが、私は矢のスタイルについて新しいことを学びます。それは素晴らしいことです! – scichris