我怎样才能画出这个图并注释,或者直接添加一个在每个单词之间添加一些文本的底栏,然后我假设通过稍微向下移动x标签使其易读
创建的示例:
起始代码:
import numpy as np
import matplotlib.pyplot as plt
# Array of values
values = np.array([[1,2,3], [1,2,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, 0), xytext=(2.5, -0.8),
fontsize=1.5, ha='center', va='bottom',
bbox=dict(boxstyle='square', fc='white'),
arrowprops=dict(arrowstyle='-[, widthB=43.0, lengthB=2.5', lw=2.0))
plt.legend();
注释的坐标由轴设置,位置由手动设置
相关问题 更多 >
编程相关推荐