21

等角図の右下隅にテキストを入れたいと思います。ax.transAxes で図形に対する相対位置を設定しましたが、各図形の高さスケールに応じて手動で相対座標値を定義する必要があります。

軸の高さスケールとスクリプト内の正しいテキスト位置を知る良い方法は何でしょうか?

 ax = plt.subplot(2,1,1)
 ax.plot([1,2,3],[1,2,3])
 ax.set_aspect('equal')
 ax.text(1,-0.15, 'text', transform=ax.transAxes, ha='right', fontsize=16)
 print ax.get_position().height

 ax = plt.subplot(2,1,2)
 ax.plot([10,20,30],[1,2,3])
 ax.set_aspect('equal')
 ax.text(1,-0.15, 'text', transform=ax.transAxes, ha='right', fontsize=16)
 print ax.get_position().height                                              

ここに画像の説明を入力

4

1 に答える 1