0

I have an issue with the plot with lines command. I have to plot around 360 lines from a huge data file. The sample data from my input file is

-180.00000000,-10.00000000,0.00000000,0.01000000,0.00000000
-179.00000000,-10.00000000,0.07551000,0.01060500,0.04000000
-178.00000000,-10.00000000,0.15102000,0.01121000,0.08000000
-177.00000000,-10.00000000,0.22653000,0.01181400,0.12000000
-176.00000000,-10.00000000,0.30204000,0.01241900,0.16000000
-175.00000000,-10.00000000,0.37755000,0.01302400,0.20000000
-174.00000000,-10.00000000,0.45306000,0.01362900,0.24000000
-173.00000000,-10.00000000,0.52857000,0.01423400,0.28000000
-172.00000000,-10.00000000,0.60408000,0.01483900,0.32000000
-171.00000000,-10.00000000,0.67959000,0.01544300,0.36000000
-170.00000000,-10.00000000,0.75510000,0.01604800,0.40000000
-169.00000000,-10.00000000,0.73638000,0.02735300,0.38295000
-168.00000000,-10.00000000,0.71766000,0.03865800,0.36590000

For the followind code

reset
set terminal epslatex size 13.1cm,6cm color colortext
set output 'C:\MajCha\gnuplot\alpha_cl.tex'
filename= 'C:\MajCha\gnuplot\DU_08-W-180-65_cf_c_02_InpPrePro.txt'
#
unset key
set xrange [-10:10]
set yrange [-3:3]
plot for [i=-180:180] filename using (($1==i)?$2:1/0):3 
#
unset output
reset

I got the following graph enter image description here

for the following code

reset
set terminal epslatex size 13.1cm,6cm color colortext
set output 'C:\MajCha\gnuplot\alpha_cl_betaconst.tex'
filename= 'C:\MajCha\gnuplot\DU_08-W-180-65_cf_c_02_InpPrePro.txt'
#
unset key
set xrange [-180:180]
set yrange [-3:3]
plot for [i=-10:10] filename using (($2==i)?$1:1/0):3 with lines
#
unset output
reset

the result is a empty figure enter image description here

I have also use awk in which case it is showing "awk is not recognised as internal or external command" and it is skipping without plotting anything. I want the plot with lines instead of lines.

1 Answer 1

0

Correct me if I am wrong, may you have confused the meaning of the ternary operator?

A?B:C means that if A is true, the use B else use C.

So (($1==i)?$2:1/0):3 mean that for the lines where the value of column 1 is equal to i plot use the vallue of column 2 as x-coordinate and the value of column 3 as y-coordinate. Only one line for each iteratioin (first line in first iteration, second line in second iteration, etc) fulfill this criterion, so you only get a dot from each iteration.

(($2==i)?$1:1/0):3 means that for lines where the value of column 2 equals i, use this lines value in column one as the x-coordinate, and the value of column 3 (again) as the y-coordinate. This command chould work on that file though, judging form your data. So i dont know what is wrong. Maybe they are out of your plotting range. COmment out the range specifiers and see if you see anything. Gnuplot shuold autoscale.

However if all this was clear to you but you just need lines between the points, I'm not sure how to achieve that.

also your last sentece "I want the plot with lines instead of lines." is vague.

A tip is to use terminal qt or terminal wxt or terminal x11 to get interactive pop-up plot windows, instead of epslatex which you can use later when you are ready for production. Then it is easier to experiment.

Sign up to request clarification or add additional context in comments.

Comments

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.