I am trying to make a pyplot graph, but my x and y values are of different length.
I am using numpy's arange function to create the range of x values based on the length of my list of y values.
def event_editor(EventDatabase, ConcatenatedEvents, ConcatenatedFits):
for i in list(EventDatabase):
# Check for events with absurd blockage current
if abs(EventDatabase[i]['AllLevelFits'][0]) > 5:
del EventDatabase[i]
continue
event = ConcatenatedEvents[i][0]
fit = ConcatenatedFits[i]
x_values = np.arange(0, len(event) / 100, .01)
x_values2 = np.arange(0, len(fit) / 100, .01)
fig = plt.figure()
plt.plot(x_values, event, figure=fig)
plt.plot(x_values2, fit, figure=fig)
plt.xlabel('Time (ms)', figure=fig)
plt.ylabel('Current (I)', figure=fig)
plt.title('Event #' + str(i), figure=fig)
plt.show()
I'd expect the x_values and the event/fit lists to have the same length, and most of the time they do have the same length. However, when the length of event/fit is 111, the length of the x_values is 112. What causes this?