Search code examples
loopsplotgnuplot

Graph a batch of plots using Gnuplot


I need to plot several intervals of a set of data. Let's say that from a file of 10,500 lines I want the graph each 1500 lines. I came up with a code that works partially. The variable that I am using in de DO cycle does not move the interval of plotting

Here is my gnuplot snipet

set datafile separator comma
set xlabel 'Tiempo [minutos]' font ',20'
set ylabel 'Precio [USD]' font ',20'
set term png font 'Ubuntu,15'


do for [intervalo = 1:10] {
    plot 'WTI_Intraday_1min_2011_2012.csv' every ::intervalo::intervalo+1499 u 0:2  w l lt rgb 'red' lw 1 title ''.intervalo.''
    set output 'Grafica_Intervalo'.intervalo.'.png'
}

It outputs 10 plots with the proper name but the interval does not chages the 10 plots are of the interval [1,1500]. Any ideas on how can I make the interval increase?


Solution

  • The script works perfectly fine, the reason I noted "no change" was because the interval only added +1. If I change the way the variable "intervalo" increases is obvious that the script works.