Python 如何在matplotlib中添加平行于y轴的线?
我想在Python 如何在matplotlib中添加平行于y轴的线?,python,matplotlib,Python,Matplotlib,我想在x=c#constant处画一条线 这应该很简单,但我该怎么做呢 您可以使用 使用matplotlib.pyplot的axvline方法: import matplotlib.pyplot as plt plt.axvline(x=0.5) 您还可以设置y值的范围: plt.axvline(x=0.5, ymin=0.2, ymax=0.4) ymin=0和ymax=1的默认值是指x=2,x=3等吗? plt.axvline(x=0.5, ymin=0.2, ymax=0.4)
x=c#constant
处画一条线
这应该很简单,但我该怎么做呢 您可以使用
使用
matplotlib.pyplot
的axvline
方法:
import matplotlib.pyplot as plt
plt.axvline(x=0.5)
您还可以设置y值的范围:
plt.axvline(x=0.5, ymin=0.2, ymax=0.4)
ymin=0
和ymax=1
的默认值是指x=2
,x=3
等吗?
plt.axvline(x=0.5, ymin=0.2, ymax=0.4)