当前位置:网站首页>visdom画多条动态损失曲线

visdom画多条动态损失曲线

2022-06-23 03:58:00 andrew P

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":500,
    "height":300,
    "legend":['b','c','d']
}
opts2 = {
    "title": 'chart example2',
    "xlabel":'x',
    "ylabel":'y',
    "width":500,
    "height":300,
    "legend":['b','c','d']
}
for i in range(1000):
    x.append(i)
    Yn.append([i*80, i**2, -i*100-100])

    ##方式一,replace
    viz.line(X=x, Y=Yn, win='chart1',env='dynamic', opts=opts1)

    ##方式二,append
    viz.line(X=[i], Y=[[i * 80, i ** 2, -i * 100 - 100]], win='chart2', env='dynamic',update='append',
             opts=opts2)
    sleep(0.01)

 

原网站

版权声明
本文为[andrew P]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41166909/article/details/125415243