python - How can you plot two lists of different 'first dimension' using matplotlib? -
i trying write code plots graph whilst going through loop , updates graph each iteration using matplotlib. plotting voltage_trim[0:index] in order avoid problem of having 2 lists of different size still error x , y must have same first dimensions. know how 1 plots 2 lists of different size have updating real time graph?
voltage_trim = range(16) current_meas = [] fig1 = plt.figure() index, value in enumerate(voltage_trim): current_meas.append(random.randint(0,10)) plt.cla() plt.plot(voltage_trim[:index], current_meas )
your idea of trimming x values good. make work use voltage_trim[:index+1]
.
the index enumerate starts @ zero, first returned element want select 1 x value. therefore need values index+1.
Comments
Post a Comment