i have a truss bridge that i want to draw using fortran 90 and Gnuplot , but the truss elements should change color if the corresponding array element is bigger or smaller than zero
open(10,file='plot_2D.plt')
write(10,*) 'set title " truss"'
write(10,*) 'set xrange [0:300]'
write(10,*) 'set yrange [0:40]'
write(10,*) 'set xlabel "x [U]"'
write(10,*) 'set ylabel "y [U]"'
write(10,*) 'set key noautotitle'
write(10,*) 'plot "1.txt" if (x(1) > 0 ) {with line 7} else { with line lt 3 } '
write(10,*) 'pause -1 "Hit return to continue"'
close(10)
ofcourse i have 1.txt up to 222.txt
but i just put one here because it is repetitive process
but i dont get any plot ,
what is my mistake ?
It is not clear what exactly you mean by x(1) > 0
since there is no function x() defined. Assuming that x(1)
means data value in column 1
, then instead of
write(10,*) 'plot "1.txt" if (x(1) > 0 ) {with line 7} else { with line lt 3 } '
the correct syntax is
write(10,*) 'plot "1.txt" using 1:2:($1>0 ? 7 : 3) with lines linecolor variable'