|
50 | 50 | s = np.cos(2*np.pi*t)
|
51 | 51 | line, = ax.plot(t, s, lw=3, color='purple')
|
52 | 52 |
|
53 |
| - ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction', |
54 |
| - horizontalalignment='center', verticalalignment='center') |
| 53 | + ax.annotate('figure pixels', |
| 54 | + xy=(10, 10), xycoords='figure pixels') |
55 | 55 |
|
56 |
| - ax.annotate('pixels', xy=(20, 20), xycoords='figure pixels') |
| 56 | + ax.annotate('figure points', xy=(80, 80), |
| 57 | + xycoords='figure points') |
57 | 58 |
|
58 |
| - ax.annotate('points', xy=(100, 300), xycoords='figure points') |
59 |
| - |
60 |
| - ax.annotate('offset', xy=(1, 1), xycoords='data', |
61 |
| - xytext=(-15, 10), textcoords='offset points', |
| 59 | + ax.annotate('point offset from data', xy=(2, 1), |
| 60 | + xycoords='data', |
| 61 | + xytext=(-15, 25), textcoords='offset points', |
62 | 62 | arrowprops=dict(facecolor='black', shrink=0.05),
|
63 | 63 | horizontalalignment='right', verticalalignment='bottom',
|
64 | 64 | )
|
65 | 65 |
|
66 |
| - ax.annotate('local max', xy=(3, 1), xycoords='data', |
| 66 | + ax.annotate('axes fraction', xy=(3, 1), xycoords='data', |
67 | 67 | xytext=(0.8, 0.95), textcoords='axes fraction',
|
68 | 68 | arrowprops=dict(facecolor='black', shrink=0.05),
|
69 | 69 | horizontalalignment='right', verticalalignment='top',
|
70 | 70 | )
|
71 | 71 |
|
72 |
| - ax.annotate('a fractional title', xy=(.025, .975), |
| 72 | + ax.annotate('figure fraction', xy=(.025, .975), |
73 | 73 | xycoords='figure fraction',
|
74 | 74 | horizontalalignment='left', verticalalignment='top',
|
75 | 75 | fontsize=20)
|
76 | 76 |
|
77 | 77 | # use negative points or pixels to specify from right, top -10, 10
|
78 | 78 | # is 10 points to the left of the right side of the axes and 10
|
79 | 79 | # points above the bottom
|
80 |
| - ax.annotate('bottom right (points)', xy=(-10, 10), |
81 |
| - xycoords='axes points', |
82 |
| - horizontalalignment='right', verticalalignment='bottom', |
83 |
| - fontsize=20) |
| 80 | + ax.annotate('pixel offset from axes fraction', xy=(1, 0), |
| 81 | + xycoords='axes fraction', |
| 82 | + xytext=(-20, 20), |
| 83 | + textcoords='offset pixels', |
| 84 | + horizontalalignment='right', |
| 85 | + verticalalignment='bottom') |
84 | 86 |
|
85 | 87 |
|
86 | 88 | if 1:
|
|
0 commit comments