I want to plot different lines in a single image. Each line is saved in a different plain text file and it has: x | y | depth. Therefore, I have write this file named 'plot_vg':
set term pngcairo size 1000,8005
list = system('ls')
i = 1
set output 'image.png'
do for [file in list] {
if (file ne 'image.png') {
if (file ne 'plot_vg') {
if (file ne '..') {
if (i==1) {
i=0
plot sprintf('%s',file) using 1:2:3 with lines notitle
} else{
replot sprintf('%s',file) using 1:2:3 with lines notitle
}
}
}
}
}
My problem is that at the end, the saved image is only of the last replot without including the rest of lines. I have seen that it's entering well to the loop and it does 1 plot and then, the rest are replots. If I open gnuplot from term and I write first 1 plot and then replots, the image shown is what I want. Where's the error here?
I tried the first option from here Gnuplot - Using replot with png terminal but I'm getting a blank image file.