torch / gnuplot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using gnuplot's multiplot

thelinuxmaniac opened this issue · comments

Hi,
I want to put multiple gnuplot.imagesc() plots in a single image file. So I try to do it as follows but it doesn't work. Only the last plot is appears in the image. It seems that gnuplot.imagesc() flushes everything set using gnuplot.raw()

require 'gnuplot'

x1 = torch.rand(10,10)
x2 = torch.rand(10,10)

gnuplot.setterm('png')
gnuplot.pngfigure('test.png')
gnuplot.raw('set multiplot layout 1,2')

gnuplot.imagesc(x1, 'color') -- first subplot
gnuplot.title('x1')

gnuplot.imagesc(x2, 'color') -- second subplot
gnuplot.title('x2')

gnuplot.raw('unset multiplot')
gnuplot.plotflush()

test

HI,
It seems like that GNU require "set output" before going in multiplot mode. But "set output" was commented out in "function filefigure" of this version. So you have to call it via "gnuplot.raw("set output 'test.png'") before "set multiplot". And another thing is that do not call plotflush at the end. Because it will call "set output" again.

require 'gnuplot'

x1 = torch.rand(10,10)
x2 = torch.rand(10,10)

gnuplot.setterm('png')
gnuplot.pngfigure('test.png')
gnuplot.raw("set output 'test.png'") -- set output before multiplot
gnuplot.raw('set multiplot layout 1,2')

gnuplot.raw("set title 'x1'")
gnuplot.imagesc(x1, 'color') -- first subplot

gnuplot.raw("set title 'x2'")
gnuplot.imagesc(x2, 'color') -- second subplot

gnuplot.raw('unset multiplot')

test

Thank you.