annotate

plt.annotate('text at top left',xy=(0.05, 0.95), xycoords='figure fraction', /

ha='left', va='bottom')

plt.annotate('text at top center',xy=(0.5, 0.97), xycoords='figure fraction', /

ha='center', va='bottom')

plt.annotate('text at bottom right',xy=(0.95, 0.03), xycoords='figure fraction', /

ha='right', va='bottom')

textを図の画面に描く.text関数よりもこちらが使いやすい.

plt.annotate(cttl,xy=(0.01, 0.01), xycoords='figure fraction')

xycoordsには,

data データ座標系

figure fraction 画面全体の相対位置

axes fraction 1パネルについての相対位置

が使いやすいだろう.後の二つはどちらも左下が(0,0)右上が(1,1).

horizontalalignment (またはha)='center' | 'left' | 'right'

This function draws text in a figure. This is a better function than "text" function.

plt.annotate(cttl,xy=(0.01, 0.01), xycoords='figure fraction')

useful xycoords options are

data: data coordinate

figure fraction : relative position within a page (figure in matplotlib's terminology)

axes fraction: relative position for a figure panel (axes)

In the latter two cases, (0,0) means bottom left corner and (1,1) means top right corner.

example

plt.annotate('EU delays',xy=(0.95, 0.03), xycoords='figure fraction', /

horizontalalignment='right', verticalalignment='bottom')