求问图中的黄色线段用python怎么画
直线代表几个点的拟合回归线,黄色线段表示的是实际值与拟合值之间的差值,主要是不知道黄色线段怎么画
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")