[Solved] Using for-loop values to create a basic graph


x and y are single floats, not arrays as indicated by the output of your print statement. plt.plot() tries to draw lines between points, but since there is only one point, there can be no line. I would assume you want to somehow make x and y into arrays of values perhaps something like this…

x = []
y = []
for i in range(0, 1032):
    x.append(g[0].time[i])
    y.append(g[0].data[0].f[i])

then when passed to plt.plot there is more than one point to plot
alternately if you want a scatter plot on non-connected points, use plt.scatter

2

solved Using for-loop values to create a basic graph