printf - Using two arguments in sprintf function in gnuplot -


i've been trying graph several files on same gnuplot graph using sprintf read in filenames. can read in 1 argument o.k. if write:

filename(n) = sprintf("oi04_saxs_%05d_ave_div_sub.dat", n) plot [i=1:10] filename(i) u 1:2 

then graph o.k , files argument plotted on same graph. have string of characters changes near end of filename , when try reflect in

filename(n,m) = sprintf("oi04_saxs_%05d_0001_%04s_ave_div_sub.dat",n,m)  plot [i=1:10] filename(i,m) u 1:2  

i following error message: 'undefined variable m'. i've tried removing loop , running

plot filename(m) 

and results in same error message. in understanding what's going wrong , how fix appreciated :)

this full script:

unset multiplot reset  set termoption enhanced set encoding utf8  set term pdf size 18cm,18cm font 'arial'  set pointsize 0.25  set output 'stoppedflowresults.pdf'  set logscale  set xlabel '{/:italic r} / [q]' set ylabel '{/:italic intensity}'  filename(n) = sprintf("./result_curve-%d.txt/estimate.d", n)  mycolorgradient(n) = sprintf("#%02x00%02x", 256-(n-1)*8-1, (n-1)*8)  set key off  set multiplot layout 2,1  filename(n,m) = sprintf("oi04_saxs_%05d_0001_%04s_ave_div_sub.dat",n,m);  plot [i=1:10] filename(i,m) u 1:2 not  unset multiplot  set output 

based on help for, can have nested iterations e.g.:

plot [i=1:3] [j=1:3] sin(x*i)+cos(x*j) 

in case can mix strings (you have yet define string possible values) like:

plot [i=1:3] [m in "a b c d"] filename(i,m) u 1:2 not 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -