Matplotlib xycoords由数据(x位置)和图形/轴(y位置)给出的注释?
是否可以在xycoords由datax位置和图形或轴y位置给出的位置进行注释?是的。这是一个验证我答案的演示代码Matplotlib xycoords由数据(x位置)和图形/轴(y位置)给出的注释?,matplotlib,Matplotlib,是否可以在xycoords由datax位置和图形或轴y位置给出的位置进行注释?是的。这是一个验证我答案的演示代码 import matplotlib.pyplot as plt import matplotlib.transforms as transforms fig, ax = plt.subplots() # the x coords of this transformation are data, and the # y coord axes # Note the use of
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
fig, ax = plt.subplots()
# the x coords of this transformation are data, and the
# y coord axes
# Note the use of different .transXXXX options
trans = transforms.blended_transform_factory(ax.transData, \
ax.transAxes)
ax.plot((12,43,56),(632,0,543))
# annotate() takes `xycoords=trans`
# head location
xh = 30 #Data coordinate
yh = 0.25 #Axes coordinate
# tail location (also text)
xt = 40 #Data coordinate
yt = 0.5 #Axes coordinate
ax.annotate("v-centered", (xh, yh), xytext=(xt, yt), \
xycoords=trans, arrowprops={'arrowstyle': '->'})
plt.show()
看,是的,就是这个。虽然我不能完全用你的答案来理解它,但我也可以通过上面的@JohanC链接来理解它。