Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 处画一条线x=c #constant。
x=c #constant
这应该很简单,但我该怎么做呢?
您可以使用matplotlib.pyplot.axvline().
matplotlib.pyplot.axvline()
import matplotlib.pyplot as plt plt.figure() plt.axvline(x=0.2) plt.axvline(x=0.5) plt.show()
使用matplotlib.pyplot'saxvline方法:
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。
ymin = 0
ymax = 1