torch7绘图:多图排列 gnuplot multiplot

Multiplot命令可以将几个图放置在同一个页面、窗口或屏幕上。

The command multiplot places several plots are placed on the same page, window, or screen.

Syntax:

set multiplot { layout ,
{rowsfirst|columnsfirst} {downwards|upwards}
{title }
{scale {,}} {offset {,}}
}

unset multiplot

torch/gnuplot.lua支持了plot,splot,scatter3,imagesc,bar,hist接口,raw可以输入gnuplot原始命令。使得我们可以用lua语言将torch7数据绘制成gnuplot图片。

窍门:

除了将torch数据输入到窗口时用封装接口,对窗口设置都用raw接口。强调虽然xlabel,title等命令也有封装接口,别在multiplot时使用,会造成子图重叠错乱。

使用案例:

require "gnuplot"
require "torch"

x1 = torch.randn(20, 20)
x2 = torch.randn(10, 10)
x3 = torch.randn(5, 5)

gnuplot.setterm("png")
gnuplot.pngfigure("test.png")
gnuplot.raw("set output 'test.png'") --a necessary step before multiplot
gnuplot.raw("set multiplot layout 2,2 columnsfirst title 'MyFigure'")

--first plot
gnuplot.raw([[set title 'x1'
set xlabel 'X'
set ylabel 'Y'
]])
gnuplot.imagesc(x1, "color")

--second plot
gnuplot.raw([[set title 'x2'
set xlabel 'X'
set ylabel 'Y'
]])
gnuplot.imagesc(x2, "color")

--third plot
gnuplot.raw([[set title 'x3'
set xlabel 'X'
set ylabel 'Y'
]])
gnuplot.imagesc(x3, "color")

gnuplot.raw("unset multiplot")

在这里插入图片描述

###参考

multiplot syntax

torch/gnuplot Issue#17

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值