2

I am using gnuplot with the postscript eps terminal, this is my script:

set terminal postscript eps enhanced solid "Helvetica" 14
set output "gamma_off_real.ps"
set title 'L=4, N_{up}=N_{dw}=2, U=1.0 with HF, step, V_0=1, Ntimestep=400, Tinterval=10'
set xlabel 'time'
set ylabel 'Re({/Symbol g}_{ij})'
set yrange [-0.5:1]
do for [j=1:(nsit-1)] {do for [i=1:(nsit-j)] {plot 'time/fort.99' u (column(1)):(column((i-1)*nsit+i+j+1)) w l lt 1 lc ((-((j-1)*j)/2+(j-1)*nsit)+i+nsit) lw 3 t sprintf('Re({/Symbol g}_{%i%i})',i,i+j)}}

I use a two nested for loops by at the end in my .ps file I have more than one pages each with only one curve. What should I change to have all the curves in the same plot?

1 Answer 1

3

You must use the syntax plot for ..., which can also be nested:

plot for [j=1:(nsit-1)] for [i=1:(nsit-j)] 'time/fort.99' u ...

Update: this doesn't work, in the plot for ... for structure the second index cannot depend on the first one. The following plots only three curves instead of six:

plot for [j=1:3] for [i=1:j] i*x + j

Some very ugly like the following could work:

s = ''
do for [j=1:(nsit-1)] { do for [i=1:(nsit-j)] { s = s . sprintf('%d %d ', i, j) }}
i(w) = int(word(s, 2*w - 1))
j(w) = int(word(s, 2*w))
plot for [w=1:words(s)/2] 'time/fort.99' u (column(1)):(column((i(w)-1)*nsit+i(w)+j(w)+1)) w l lt 1 lc ((-((j(w)-1)*j(w))/2+(j(w)-1)*nsit)+i(w)+nsit) lw 3 t sprintf('Re({/Symbol g}_{%i%i})',i(w),i(w)+j(w))}}
Sign up to request clarification or add additional context in comments.

2 Comments

Whit the nested plot for I have some problem: additional pair index are plotted. For exemple for nsit=4 I obtain 9 curves instead of 6 because it seems that the i counter always run from 1 to 3 and not 1 to 4-j
You are right. Seems like changing one iteration limit based on another one isn't possible: plot for [j=1:3] for [i=1:j] i*x + j plot three curves instead of 6. Then I can't help you (at the moment at least).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.