Using gnuplot's multiplot
thelinuxmaniac opened this issue · comments
Abhishek Dutta commented
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()
Jiakai Zhang commented
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')
Abhishek Dutta commented
Thank you.