W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
# 这三行代码使编译器能够绘图:
import sys
import matplotlib
matplotlib.use('Agg')
​
import matplotlib.pyplot as plt
import numpy as np
​
# y 轴数据点:
ypoints = np.array([3, 8, 1, 10])
​
# 绘制点线样式的折线图:
plt.plot(ypoints, linestyle = 'dotted')  
plt.show()
​
# 这两行代码使编译器能够输出图形:
plt.savefig(sys.stdout.buffer)
sys.stdout.flush()