Reputation: 271
I have got the following errors while the using the code.
gnuplot> set terminal epslatex size 13.1cm,6cm color colortext
Terminal type set to 'epslatex'
Options are ' leveldefault color colortext \
dashed dashlength 1.0 linewidth 1.0 butt noclip \
nobackground \
palfuncparam 2000,0.003 \
input size 13.10cm, 6.00cm "" 11 fontscale 1.0 '
gnuplot> set output 'C:\MajCha\gnuplot\alpha_cl.tex'
gnuplot> filename= 'C:\MajCha\gnuplot\DU_08-W-180-65_cf_c_02_InpPrePro.txt'
gnuplot> #
gnuplot> set xrange [-10:10]
gnuplot> set yrange [-3:3]
gnuplot> plot "< awk '$1==-180.0 { print $2, $3 }'" filename using 2:3
warning: Skipping unreadable file "< awk '$1==-180.0 { print $2, $3 }'"
No data in plot
gnuplot> #
gnuplot> unset output
gnuplot> reset
How could I fix this error.I want the check I made §1=-180 in a loop range from -180 to 180. Please suggest me some possible ways to do.
With using the following 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
The output figure is
With using the following 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 with lines
#
unset output
reset
Upvotes: 0
Views: 594
Reputation: 2332
Since filename
is a gnuplot variable in your MWE, what you can do is concatenate its contents to the awk command:
plot "<awk '$1==-180.0 { print $2, $3 }' ".filename using 1:2
Don't miss out the space character before the closing "
: this will evaluate the command
awk '$1==-180.0 { print $2, $3 }' C:\MajCha\gnuplot\DU_08-W-180-65_cf_c_02_InpPrePro.txt
which is I believe what you want to do. Presently, it is evaluating awk with no file at all, thus there is no data.
Note that since your awk
commands prints only $2
and $3
, its output consists of 2 columns, so you probably want using 1:2
in gnuplot.
Finally, if this MWE is close to what you really want to achieve, I would advise to drop awk and use gnuplot commands only for simplicity:
plot filename using (($1==-180)?$2:1/0):3
Upvotes: 1