I am having some troubles getting the desired results when using Multiplot with a specified size and margins. I have attached a picture shows the issue when plotting my data. I am interested in merging plots with the same scale. For that I specified xsize= 0.40, ysize= 0.90, and xinit= 0.10 as in the code below. When the data files were plotted, the y-axis of the right plot was a bit lower than that of the left plot. If I was not looping, everything seems to work as expected. I even tried to move xsize= 0.40, ysize= 0.90, and xinit= 0.10 inside the for loop but no luck.
set term png
xsize= 0.40
ysize= 0.90
xinit= 0.10
do for [i=1:files] {
set output sprintf("Picture(x=-%d).png",i)
set multiplot layout 1,2
# Reset keys
unset rmargin
unset lmargin
# Set individual keys
set size xsize, ysize # Plot size in relation with canvas
set lmargin at screen xinit # x inital possition 0.10
set rmargin at screen xinit + xsize # x final possition 0.50
set xlabel "x[m]" offset 2,0 # Displace xlabel to the center of canvas
set ylabel "y[m]"
plot filename(i) using 4:3 with lines notitle
# Reset keys
unset rmargin # Clears the past x position
unset lmargin
unset label # Clears the past label
unset ytics # Removes the y axis tics
unset ylabel # Removes the y axis label
set size xsize, ysize # Plot size in relation with canvas
set lmargin at screen xinit+xsize # x inital possition 0.50
set rmargin at screen 1 - xinit # x final possition 0.90
plot filename(i) using 6:3 with lines notitle
unset multiplot
}
I wonder what could be the issue in my code. Thanks for the help.

reset sessionat the beginning? Is this really the plot you're getting with above code? Where are the axes labels and the data? For a minimal example you just can insertplot xor something else. Which gnuplot version and operating system are you using? - theozh