Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matplotlib xycoords由数据(x位置)和图形/轴(y位置)给出的注释?_Matplotlib - Fatal编程技术网

Matplotlib xycoords由数据(x位置)和图形/轴(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

是否可以在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 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链接来理解它。