标签: python function plot trigonometry repl.it
如何更改此程序,以便用户可以输入功能而不是sin(5*x)?
sin(5*x)
from math import * import matplotlib as mpl mpl.use('Agg') import numpy as np import matplotlib.pyplot as plt x = np.arange(-2*pi, 2*pi, 0.1) y1 = np.sin(5*x) plt.plot(x, y1) plt.savefig('graph.png')