Pil*_*lsy 28
如果您实际使用的是Plot(或ListPlot等),最简单的解决方案是使用GridLines选项,该选项允许您指定要绘制线条的x和y值.例如:
Plot[Sin[x], {x, 0, 2 \[Pi]},
GridLines -> {{0, \[Pi]/2, \[Pi], 3 \[Pi]/2, 2 \[Pi]},
{-1, -Sqrt[3]/2, -1/2, 0, 1/2, Sqrt[3]/2, 1}}]
Run Code Online (Sandbox Code Playgroud)

编辑添加:
当然,如果您只想在单个给定数字处绘制一条线,此解决方案就可以工作.例如,如果你想从dreeve的答案中重现第二个例子:
Plot[Sin[x], {x, 0, 2 Pi},
GridLines -> {{4}, {}}]
Run Code Online (Sandbox Code Playgroud)

dre*_*ves 16
对于水平线的情况,使用Plot最简单的技巧是只包括其他常量函数:
Plot[{Sin[x], .75}, {x, 0, 2Pi}]
Run Code Online (Sandbox Code Playgroud)
对于垂直线,有个Epilog选项Plot和ListPlot:
Plot[Sin[x], {x, 0, 2Pi}, Epilog->Line[{{4,-100}, {4,100}}]]
Run Code Online (Sandbox Code Playgroud)

但可能最好的是GridLinesPillsy的回答中给出的选项.
Hig*_*ark 10
一种方法是在Line图形中添加图形基元:
p1 = Plot[Sin[x], {x, -2*Pi,2*Pi}];
l1 = Graphics@Line[{{-2Pi,.75},{2Pi,.75}}]; (* horizontal line at y==.75 *)
Show[p1,l1]
Run Code Online (Sandbox Code Playgroud)

另一种方法是摆弄GridLines.