作者:看看
链接:https://www.zhihu.com/question/21929761/answer/164975814

可以使用:

vlines(x, ymin, ymax)

hlines(y, xmin, xmax)

import matplotlib.pyplot as plt
import numpy as np


def Laplacian_Prior(x, u, b):
    
    return 1.0/(2*b)*np.exp(-abs(x - u)/b)

if __name__ == "__main__":
    
    x = np.arange(-10, 10, 0.01)
    y_1 = Laplacian_Prior(x, 0, 1)
    y_2 = Laplacian_Prior(x, 0, 2)
    y_3 = Laplacian_Prior(x, 0, 4)
    y_4 = Laplacian_Prior(x, -5, 4)
    plt.plot(x, y_1, "r-")
    plt.plot(x, y_2, "k-")
    plt.plot(x, y_3, "b-")
    plt.plot(x, y_4, "g-")
    plt.vlines(0, 0, 0.5, colors = "c", linestyles = "dashed")


Python 使用 Matplotlib 做图时,如何画竖直和水平的分割线或者点画线或者直线?

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2021-08-04
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
猜你喜欢
  • 2021-08-11
  • 2022-12-23
  • 2021-11-06
  • 2021-08-26
  • 2021-07-15
  • 2021-12-01
相关资源
相似解决方案