https://zhuanlan.zhihu.com/p/98563580
https://github.com/facebookresearch/visdom

安装

安装:pip install visdom
开启 visdom 服务:python -m visdom.server

会出现以下内容

  1. Checking for scripts.
  2. It's Alive!
  3. INFO:root:Application Started
  4. You can navigate to http://localhost:8097

打开 http://localhost:8097 即可看见界面

使用

  1. import torch
  2. from visdom import Visdom
  3. import numpy as np
  4. # 新建名为'demo'的环境
  5. viz = Visdom(env='demo') # 默认是 main
  6. N = np.linspace(-5, 5, 100) # 从范围[-5,5]中均匀取100个数
  7. viz.line(
  8. X=np.column_stack((N, N)),
  9. Y=np.column_stack((N*N, np.sqrt(N+5))),
  10. opts=dict(legend=["curv1", "curv2"],
  11. showlegend=True,
  12. markers=False,
  13. title='line demo',
  14. xlabel='Time',
  15. ylabel='Volume',
  16. fillarea=False),
  17. )
  18. """
  19. opts参数含义:
  20. legend:给每条曲线指定名字;
  21. showlegend:显示曲线的图例(默认用 1,2,3... 表示);
  22. markers:表示是否将每个点用实心圆表示;
  23. title:指定该图的标题;
  24. fillarea:指定是否对曲线下方进行填充;
  25. xlabel 和 ylabel:指定横纵坐标名字。
  26. """

image.png