Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiplot on multiple pages pdf gnuplot

Tags:

gnuplot

The title says it all, I want a multiple page pdf, but on each page I want multiple plots. I thought that multipage was the default for a pdf, but I cannot seem to get it to work. Here is a boiled down simplified code

set terminal pdf
set output "trial.pdf"
set multiplot layout 2,2
plot cos(x)
plot cos(2*x)
plot cos(3*x)
plot cos(4*x)
plot cos(5*x)

This only gives me one page and the last plot is no where to be found. What am I misunderstanding?

Thanks!

like image 537
Josh Avatar asked Apr 09 '26 11:04

Josh


1 Answers

Did not the fifth plot plot on top of the first plot? That would be the normal behavior here. You specified layout 2,2. That means there is logical space for 2 rows of 2 columns of plot. What you need to do, is unset multiplot where you want the page break and then set it again for the next page. This example is just 1 row with 3 columns for each page. You can adjust as necessary.

set terminal pdf
set output "trial.pdf"
set multiplot layout 1,3
plot cos(x)
plot cos(2*x)
plot cos(3*x)
unset multiplot
set multiplot layout 1,3
plot cos(4*x)
plot cos(5*x)
plot cos(5*x)
unset multiplot
like image 98
Dan Sp. Avatar answered Apr 11 '26 18:04

Dan Sp.