是否可以在 matplotlib 中显示多行注释?
这是单行注释:
ax.annotate('line1', xy=(xi,yi), xycoords='data',
xytext=(-50, 30), textcoords='offset points',
arrowprops=dict(arrowstyle="->")
)
Run Code Online (Sandbox Code Playgroud)
这就是我需要做的(这是以图形方式编辑的):

就像在行尾添加“\n”一样简单:
'第1行\n第2行\n第3行"
ax.annotate('line1 \n line2', xy=(timeNow, y), xycoords='data',
xytext=(-50, 30), textcoords='offset points',
arrowprops=dict(arrowstyle="->"),
verticalalignment='center',
horizontalalignment='center'
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5731 次 |
| 最近记录: |