问题描述
我怎样才能对这个图进行注释或直接添加一个在每个单词之间添加一些文本的下括号,然后我假设稍微向下移动 x 标签以使其清晰易读。
创建示例:
起始代码:
import numpy as np
import matplotlib.pyplot as plt
# Array of values
values = np.array([[1,2,3],[1,3]])
# Line plot
fig,ax = plt.subplots()
plt.plot(values[0,:],values[1,'bo-',label='$P_{1}$')
# Annotate the points of interest
ax.annotate('s',xy=(1.5,0),xytext=(1.5,-0.8),fontsize=1.5,ha='center',va='bottom',bBox=dict(Boxstyle='square',fc='white'),arrowprops=dict(arrowstyle='-[,widthB=45.0,lengthB=1.5',lw=2.0))
ax.annotate('t-s',xy=(2.5,xytext=(2.5,widthB=43.0,lengthB=2.5',lw=2.0))
plt.legend();