Sugar G. García
Sugar G. García

Reputation: 19

Gnuplot internal error : STRING operator applied to undefined or non-STRING variable

I was trying to plot a 18 line graph with gnuplot, so I used the code below and it shows the non-string variable error.

plot for [num = 4560 : 5072 : 64] \
    "graph_".num.".dat" using 1:4 with lines lw 2 title "".num.".fast", \
    "graph_".num.".dat" using 1:2 with lines lw 2 title "".num.".slow"
replot

But when I only use one, it works perfectly. I thought it could be because of a maximum number of lines in the legend or something. How can I plot these 18 lines in the same graph?

Upvotes: 0

Views: 4079

Answers (1)

Sugar G. García
Sugar G. García

Reputation: 19

Ok, I found the problem, you have to set the loop twice, because they are different plots.

plot for [num = 4560 : 5072 : 64] \
   "graphs/tam_".num.".dat" using 1:4 with lines lw 2 title "".num.".fast", \
     for [num = 4560 : 5072 : 64] \
    "graphs/tam_".num.".dat" using 1:2 with lines lw 2 title "".num.".slow"
replot

Upvotes: 1

Related Questions