请插入 "精确 "的值在 x
答案 y
import matplotlib.pyplot as plt
# data, the length of the two lists MUST be the same
x = [0, 6, 10, 15, 17, 26, 28]
y = [0, 20, 20, 30, 30, 0, 0]
# plot the data
plt.plot(x,y)
# modify the ticks to show directly the values
plt.xticks(x)
plt.yticks(sorted(set(y)))
# make a grid
plt.grid(1)
# tell matplotlib "we are done, please show what we have prepared"
plt.show()
要从你的图像中读出准确的数值是相当困难的,你必须自己输入正确的数值。如果你有任何问题,请随时提问。
import matplotlib.pyplot as plt
x = [0, 6, 10, 15, 22, 26]
y = [0, 22, 22, 27.5, 27.5, 0]
# optional; making the y axis go up to 45
axes = plt.gca()
axes.set_ylim([0, 45])
plt.plot(x,y)
plt.show()