可调用参数简介
opts.title
: figure titleopts.width
: figure widthopts.height
: figure heightopts.showlegend
: show legend (true
orfalse
)opts.xtype
: type of x-axis ('linear'
or'log'
)opts.xlabel
: label of x-axisopts.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
ofnumber
s)opts.xticklabels
: ticks labels on x-axis (table
ofstring
s)opts.xtickstep
: distances between ticks on x-axis (number
)opts.ytype
: type of y-axis ('linear'
or'log'
)opts.ylabel
: label of y-axisopts.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
ofnumber
s)opts.yticklabels
: ticks labels on y-axis (table
ofstring
s)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