# 这三行代码使编译器能够绘图:
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
xpoints = np.array([1, 2, 6, 8]) # x 轴数据点
ypoints = np.array([3, 8, 1, 10]) # y 轴数据点
plt.plot(xpoints, ypoints) # 绘制 x-y 折线图
plt.show()
# 这两行代码使编译器能够输出图形:
plt.savefig(sys.stdout.buffer)
sys.stdout.flush()