python - 如何在 matplotlib 中添加一条平行于 y 轴的线?

标签 python matplotlib

我想在 x=c#constant 处画一条线。

这应该很简单,但我该怎么做呢?

最佳答案

您可以使用 matplotlib.pyplot.axvline() .

import matplotlib.pyplot as plt

plt.figure()
plt.axvline(x=0.2)
plt.axvline(x=0.5)
plt.show()

enter image description here

关于python - 如何在 matplotlib 中添加一条平行于 y 轴的线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14139793/

相关文章:

python - 将字典与自身进行比较并有效地删除相似的键

python - jira-python search_issues() 返回空列表

python - 如果元素包含 '>",则在列表中插入一个字符

python - 如何退出 matplotlib 并在之后继续代码

python - 为什么 scipy.optimize.curve_fit 不适合数据?

python - Pandas 从数据透视表绘图

python - 这个组合器有名字吗?

python - Pandas 计算多列

python - matplotlib.pyplot.legend() 出现类型错误 : zip argument #2 must support iteration,

python - Matplotlib - 在边缘一致地显示或隐藏网格线