from visdom import Visdom
from time import sleep
'''
以这三条曲线为例:
y = 80*x
y = x**2
y = -100*x-100
'''
viz = Visdom()
x =[]
Yn =[]
opts1 ={"title":'chart example1',"xlabel":'x',"ylabel":'y',"width":300,"height":200,"legend":['b','c','d']}
opts2 ={"title":'chart example2',"xlabel":'x',"ylabel":'y',"width":300,"height":200,"legend":['b','c','d']}for i inrange(1000):
x.append(i)
Yn.append([i*80, i**2,-i*100-100])##方式一,replace
viz.line(X=x, Y=Yn, win='chart1', opts=opts1)##方式二,append
viz.line(X=[i], Y=[[i *80, i **2,-i *100-100]], win='chart2', update='append',
opts=opts2)
sleep(0.01)