I have tried many times to draw a simple graph, but they always give an error. What needs to be fixed in the code?
y = np.zeros(10)
x = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
for i in range(len(x)):
y[i] = math.cos(x[i])
g = ROOT.TGraph(len(x), x, y)
g.Draw()
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided