visdom 绘制条形图(柱状图)

可调用参数简介

  • opts.title : figure title
  • opts.width : figure width
  • opts.height : figure height
  • opts.showlegend : show legend (true or false)
  • opts.xtype : type of x-axis ('linear' or 'log')
  • opts.xlabel : label of x-axis
  • opts.xtick : show ticks on x-axis (boolean)
  • opts.xtickmin : first tick on x-axis (number)
  • opts.xtickmax : last tick on x-axis (number)
  • opts.xtickvals : locations of ticks on x-axis (table of numbers)
  • opts.xticklabels : ticks labels on x-axis (table of strings)
  • opts.xtickstep : distances between ticks on x-axis (number)
  • opts.ytype : type of y-axis ('linear' or 'log')
  • opts.ylabel : label of y-axis
  • opts.ytick : show ticks on y-axis (boolean)
  • opts.ytickmin : first tick on y-axis (number)
  • opts.ytickmax : last tick on y-axis (number)
  • opts.ytickvals : locations of ticks on y-axis (table of numbers)
  • opts.yticklabels : ticks labels on y-axis (table of strings)
  • opts.ytickstep : distances between ticks on y-axis (number)
  • opts.marginleft : left margin (in pixels)
  • opts.marginright : right margin (in pixels)
  • opts.margintop : top margin (in pixels)
  • opts.marginbottom: bottom margin (in pixels)

 

条形图

 

from visdom import Visdom
import numpy as np

viz = Visdom(env='exp')

viz.bar(
    X=np.abs(np.random.rand(5, 3)),   # rand(rownames个数,legend个数)
    opts=dict(
        stacked=True, # 是否堆叠在一个条形柱上
        legend=['Facebook', 'Google', 'Twitter'], # 类别
        rownames=['2012', '2013', '2014', '2015', '2016'] # 横坐标名字
    )
)

  •  
from visdom import Visdom
import numpy as np

viz = Visdom(env='exp')

viz.bar(
    X=np.random.rand(20, 3),
    opts=dict(
        stacked=False,
        legend=['The Netherlands', 'France', 'United States']
    )
)

 

from visdom import Visdom
import numpy as np

viz = Visdom(env='exp')
viz.bar(X=np.random.rand(4, 2),
        opts=dict(
        stacked=False,
        legend=['FC', 'POOL5'],
        rownames=['top-1', 'top5', 'top10', 'top20'],
        title='Test',
        ylabel='rank-k  Error Rate',  # y轴名称
        xtickmin=0.4,   # x轴左端点起始位置
        xtickstep=0.4   # 每个柱形间隔距离
    ))

 

visdom 中文文档  https://ptorch.com/news/77.html

更多详情见  https://zhuanlan.zhihu.com/p/32025746

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值