Reputation: 1
I have two lists one for the x values, and one for the y values. The list for the y -values is constantly being updated (see code). I want to make a graph out of these but I don' t know how.
Thank you for the help.
import time
import matplotlib.pyplot as plt
yvalues = []
xvalues = [0,1,2,3,4,5,6,7,8,9,10]
var = 0
nummer=0
while var < 10 : # This constructs an infinite loop
nummer=nummer+1
yvalues.append(nummer)
time.sleep(1)
# print(elements)
var=var+1
time.sleep(1)
while var==10:
nummer=nummer+1
yvalues.append(nummer)
del yvalues [0]
# print(elements)
time.sleep(1)
Upvotes: 0
Views: 207
Reputation: 77837
To make the list of (x,y) pairs, use the Python zip method:
point_list = zip(xvalues, yvalues)
The documentation is here. I assume that you can find a plotting routine in the matplotlib documentation -- or in on-line examples -- without actually needing help from us.
Upvotes: 1