绘制一条水平线,Y =在matplotlib
问题描述:
不变我使用下面绘制的水平线,matplotlib:绘制一条水平线,Y =在matplotlib
axScatter.axhline(y=0.285987, xmin=-1.5, xmax=0.491, color='black', linestyle=':')
然而,这只是非常轻微的:
我宁愿有一个函数,其中y = 0.285987之间的x范围:-1.5和〜0.72。有谁知道如何绘制线条而不使用axhline
?
答
axhline
xmin和xmax在轴坐标中给出(所以0.5是轴的中心)。 如果你想有一个确切的数据坐标的线,你可以使用绘图:
x = [-1.5, 0.72]
y = [0.285987, 0.285987]
ax.plot(x, y)