How to print input file next to graph in gnuplot? - gnuplot

Is it possible with gnuplot to print the data that I plotted next to the graph?
If I have a text file input.txt:
#x y
1 2
2 5
3 6
4 7
And I do plot 'input.txt' I'd like to have it plotted as usual and next to the plot I'd like to have the table printed. Is this possible?
Note: I'm on Windows and I'd like to format the output.

A bit late, but the OP asked for Windows... so, in short:
data = system('type yourfile.dat') # Windows
In Windows, if you give a path, you need to pay attentention about \, spaces and doublequotes ".
Data: SO22225051.dat
#x y
1 2
2 5
3 6
4 7
Script:
Solution working for both Linux and Windows. Version 1 for gnuplot>=5.2.0, Version 2 for gnuplot>=4.6.0.
### place data as table/text in graph
reset
FILE = 'SO22225051.dat'
set rmargin 15
set label 1 at screen 0.9,0.7 font "Courier New,12"
# Version 1: Windows & Linux using system() command;
# GPVAL_SYSNAME only available for gnuplot>=5.2.0
getData(f) = GPVAL_SYSNAME[1:7] eq "Windows" ? \
system(sprintf('type "%s"',f)) : \
system(sprintf('cat "%s"',f)) # Linux/MacOS
Data = getData(FILE)
set label 1 Data
plot FILE u 1:2 w lp pt 7 lc rgb "red"
pause -1
# Version 2: gnuplot-only, platform-independent, working at least with gnuplot>=4.6.0
Data = ''
set datafile commentschar ''
set datafile separator "\t"
stats FILE u (Data=Data.strcol(1)."\n") nooutput
set datafile commentschar # restore default
set datafile separator # restore default
set label 1 Data
plot FILE u 1:2 w lp pt 7 lc rgb "red"
### end of script
Result:
The only difference between version 1 and 2 is that in version 2 gnuplot will remove leading spaces for each data line.

Sure you can. The simplest way to do this in gnuplot is read in the file by calling an external command (cat on *nix, not sure on Windows) and storing the output as a variable, then setting a label on the graph. Here is how I do it:
set rmargin 8
datas = system('cat data.dat')
print datas
set label datas at graph 1.1,0.7
plot 'data.dat' notitle
This puts the data file off to the side, in place of a key.

Related

Managing labels of specific points at equal spacing in Gnuplot

My Test.dat file is given below
# Experimental data
# Col 1:2: -0.20 V
# Col 3:4: -0.50 V
# Col 5:6: -0.60 V
# Col 7:8: -0.80 V
# Col 9:10: -0.20 V-Fit
# Col 11:12: -0.50 V-Fit
# Col 13:14: -0.60 V-Fit
# Col 15:16: -0.80 V-Fit
# Col 17: Frequency (Hz)
5.3482 7.19036 5.19009 4.69308 4.81642 4.65453 4.0498 2.40795 5.31334 7.06889 5.25193 4.9429 4.84544 4.70025 4.16655 2.37037 2999.961376
5.52344 7.90454 5.39068 5.16668 4.97274 5.12448 4.11048 2.65712 5.49548 7.81383 5.46959 5.36954 5.00025 5.16492 4.21479 2.63018 2670.228481
5.71967 8.69132 5.62205 5.65348 5.14765 5.61955 4.17784 2.93241 5.69934 8.63597 5.70749 5.83187 5.17218 5.67442 4.26891 2.91798 2376.85442
5.94678 9.58147 5.87582 6.17915 5.34049 6.18747 4.25381 3.23767 5.92783 9.54365 5.96773 6.33299 5.36333 6.2332 4.32969 3.23692 2115.666866
6.19812 10.56199 6.15759 6.74797 5.56659 6.82112 4.33771 3.57603 6.18405 10.54516 6.2524 6.87578 5.5759 6.84562 4.39794 3.59018 1883.208752
6.4801 11.64968 6.46991 7.3617 5.80584 7.49994 4.43019 3.95101 6.47162 11.64985 6.56387 7.46345 5.81241 7.51651 4.47458 3.98138 1676.32103
6.79736 12.85491 6.81988 8.02473 6.07441 8.24057 4.53525 4.36556 6.79479 12.86846 6.90491 8.09969 6.07581 8.25144 4.56071 4.41467 1492.112875
7.15229 14.18271 7.20016 8.73162 6.36887 9.04089 4.65162 4.82603 7.15829 14.2122 7.27841 8.78816 6.36931 9.05612 4.65752 4.89448 1328.110695
7.55191 15.6586 7.62896 9.50105 6.70172 9.92601 4.78082 5.33289 7.56723 15.69226 7.68728 9.53223 6.69625 9.93604 4.76627 5.42529 1182.198524
8.00034 17.27448 8.1015 10.32809 7.07033 10.88906 4.91718 5.89422 8.02797 17.32279 8.13528 10.33644 7.06085 10.89831 4.88853 6.01278 1052.290201
8.50314 19.06022 8.62248 11.19793 7.48534 11.94557 5.07426 6.5306 8.54733 19.11752 8.62609 11.20482 7.46746 11.94958 5.02597 6.66261 936.6720915
9.07294 21.03544 9.20331 12.1393 7.95412 13.10161 5.25139 7.22931 9.13346 21.0926 9.16409 12.14216 7.92123 13.09767 5.18054 7.38146 833.73487
9.73628 23.1993 9.83493 13.16506 8.46833 14.36015 5.46385 8.01308 9.79517 23.26395 9.75373 13.15281 8.42758 14.35005 5.35433 8.17616 742.1225309
10.46662 25.58418 10.53342 14.27584 9.04938 15.7331 5.68565 8.8891 10.54288 25.64997 10.40018 14.24189 8.99281 15.7154 5.54982 9.05466 660.5684757
11.30874 28.21501 11.29144 15.48928 9.68926 17.24048 5.93471 9.86026 11.38806 28.26924 11.10883 15.41417 9.62368 17.20217 5.76967 10.02529 587.9849195
12.25349 31.10186 12.13787 16.77338 10.40666 18.87136 6.21695 10.91931 12.34401 31.14258 11.88582 16.675 10.32789 18.81986 6.017 11.09755 523.3734846
13.33057 34.25004 13.05039 18.12576 11.21145 20.63749 6.52501 12.08398 13.4254 34.29099 12.73752 18.02938 11.11367 20.57776 6.29518 12.28144 465.8699036
14.52877 37.72834 14.05746 19.58011 12.09233 22.54544 6.87277 13.37298 14.64928 37.73827 13.6713 19.48306 11.99046 22.4864 6.60819 13.58853 414.6769643
15.9318 41.50195 15.16613 21.13292 13.09156 24.62451 7.26236 14.7933 16.03428 41.50795 14.69473 21.0412 12.96823 24.55592 6.96033 15.03089 369.1092134
17.48885 45.62211 16.34935 22.7757 14.19823 26.87261 7.68792 16.35034 17.60142 45.62514 15.81609 22.70913 14.05795 26.79702 7.35651 16.62195 328.5482526
19.27369 50.12233 17.67077 24.53066 15.43615 29.30286 8.17511 18.10514 19.37369 50.115 17.04405 24.49177 15.27128 29.22019 7.80212 18.37601 292.4501896
21.24715 55.05442 19.06097 26.34819 16.77768 31.88924 8.70788 20.00099 21.37788 55.00665 18.38872 26.3951 16.62166 31.8378 8.30357 20.30993 260.3083849
23.54249 60.33315 20.60387 28.36038 18.30648 34.74565 9.31817 22.14781 23.64101 60.32401 19.85923 28.42264 18.12186 34.65932 8.86739 22.43973 231.7093313
26.11 66.12278 22.22766 30.45975 19.9147 37.75172 9.97577 24.48379 26.19549 66.09801 21.46706 30.58012 19.78736 37.69781 9.50167 24.7856 206.2469721
28.96331 72.36502 24.00729 32.66478 21.78825 40.99738 10.74694 27.08102 29.07368 72.35337 23.22244 32.8705 21.63268 40.96305 10.21468 27.36679 183.5897565
32.14917 78.81115 25.81999 35.0394 23.66136 44.5305 11.5696 29.81697 32.31496 79.12417 25.13871 35.29976 23.67595 44.4698 11.01685 30.20826 163.4098589
35.8012 87.27192 27.72862 37.95827 25.60681 48.59571 12.10952 32.83374 35.95462 86.43017 27.22557 37.86825 25.93176 48.22555 11.91806 33.331 145.457685
40.0451 94.46327 30.09316 40.11188 28.56734 51.9632 13.48607 36.53042 40.03846 94.30707 29.4977 40.58166 28.42045 52.24634 12.93148 36.76505 129.468739
44.3986 103.02569 32.65008 42.71365 31.26175 56.30807 14.71726 40.25237 44.60387 102.7694 31.964 43.43792 31.1564 56.53787 14.06905 40.5337 115.249306
49.41737 112.13202 35.08782 45.50361 34.194 60.78231 16.0259 44.25363 49.70523 111.85906 34.64155 46.44396 34.16358 61.12027 15.34799 44.67509 102.5795937
55.34925 121.87463 37.90832 48.52652 37.35213 65.53601 17.53973 48.83812 55.38206 121.58704 37.5385 49.59602 37.45653 65.99879 16.78315 49.21638 91.30872786
61.76343 132.12764 40.7851 51.68467 40.97616 70.53955 19.14158 53.82411 61.68653 131.98417 40.66873 52.89664 41.05688 71.18949 18.39413 54.19674 81.27465844
68.78138 143.52929 44.08481 55.09847 44.71328 76.04811 21.07635 59.25515 68.66518 143.06976 44.0424 56.34442 44.98287 76.70357 20.20096 59.65304 72.3451376
76.80008 155.39493 47.55355 58.51519 49.01537 81.63447 23.06471 65.43016 76.37021 154.87122 47.67158 59.94029 49.25591 82.55725 22.22732 65.62928 64.3953681
85.04398 167.73903 51.35647 62.37713 53.53357 88.19325 25.30311 71.80395 84.84864 167.40793 51.56509 63.68254 53.89476 88.76372 24.49798 72.16859 57.3201105
93.17163 181.47175 55.4862 65.51628 58.30892 93.54346 27.75073 79.63989 94.15319 180.70873 55.73362 67.57226 58.92174 95.34187 27.04206 79.32203 51.02064461
105.52235 196.45335 59.61517 70.90046 63.46267 101.01341 31.17511 86.25563 104.32725 194.79092 60.1829 71.60712 64.35476 102.3058 29.88918 87.13741 45.41501403
115.97845 210.39987 64.25769 74.68956 69.99201 108.74659 34.43525 95.59453 115.42434 209.68876 64.9224 75.78982 70.21792 109.67881 33.07517 95.67445 40.42405635
127.53986 225.13431 69.08642 79.4471 76.11767 117.28668 37.65949 105.68054 127.48918 225.42762 69.95699 80.12068 76.53155 117.48054 36.63702 104.99037 35.98164767
140.92206 242.20678 74.4551 83.9174 83.09223 125.49658 42.06106 115.69072 140.56961 242.04104 75.29214 84.60265 83.31863 125.73521 40.61647 115.14915 32.02725202
154.75829 259.83691 80.12594 89.0169 90.52148 134.54984 46.42489 127.68276 154.70844 259.5605 80.93057 89.23859 90.60061 134.46639 45.05776 126.21507 28.50824967
170.2029 277.82716 86.32966 94.3355 98.44053 144.18299 51.69251 139.83987 169.9593 278.03527 86.8786 94.03665 98.40554 143.70675 50.01278 138.26493 25.37528053
186.20771 298.06654 93.52445 99.54897 107.09589 153.85211 57.93742 153.12209 186.36272 297.50293 93.13671 99.0026 106.7558 153.48316 55.53356 151.36904 22.5873664
204.86235 317.13551 100.81275 105.36231 116.694 164.6805 64.21005 168.04675 203.97549 318.02476 99.71103 104.14908 115.68302 163.83429 61.68197 165.61404 20.10539174
220.57758 340.78877 108.51106 111.40893 126.84103 175.86559 71.48759 183.79241 222.85457 339.66556 106.60699 109.49035 125.21973 174.8004 68.52485 181.09001 17.89536327
242.3968 360.39263 117.40936 117.6596 136.69333 186.7789 81.70404 202.5117 243.03667 362.47065 113.82225 115.03682 135.38902 186.41157 76.12606 197.87284 15.92934132
266.83533 389.26741 126.17557 122.92684 148.57675 199.86182 86.17534 220.65631 264.59964 386.53504 121.36894 120.81201 146.2354 198.7227 84.56936 216.07449 14.17868771
286.34931 417.16655 134.61015 129.07056 161.79998 212.47665 98.31536 242.33905 287.59336 411.92448 129.24892 126.83321 157.78981 211.77344 93.93262 235.78526 12.62081787
300.73191 426.3048 143.90888 135.00097 175.51268 227.28968 110.29048 262.88944 312.10175 438.74422 137.47559 133.12797 170.10074 225.62325 104.31203 257.12554 11.2336129
329.48549 466.70438 153.15023 141.41269 189.21756 241.40532 121.01086 287.63574 338.16866 467.0569 146.04889 139.7147 183.19689 240.3092 115.79139 280.18137 9.999843314
The Gnuplot code is given below
set terminal postscript eps enhanced colour font 'Times-Bold,12' size 4in,4in
set output "EIS-Test.eps"
set style line 1 lt 1 lw 5 lc rgb "red"
set style line 2 lt 2 lw 5 lc rgb "#0008B"
set style line 3 lt 3 lw 5 lc rgb "#006400"
set style line 4 lt 4 lw 5 lc rgb "#8A2BE2"
set style line 5 lt 5 lw 5 lc rgb "dark-magenta"
set style line 6 lt 6 lw 5 lc rgb "#000FF"
set style line 7 lt 7 lw 5 lc rgb "#00008B"
set style line 8 lt 8 lw 5 lc rgb "#483D8B"
set xtics out scale 1.5
set ytics out scale 1.5
set tics font ", 16"
set xlabel "{/Times-Italic Z}_{Re} ({/Symbol \127}. cm^{-2})" font ",16"
set ylabel "{/Times-Italic -Z}_{Im} ({/Symbol \127}. cm^{-2})" font ",16"
set key inside left top
set key samplen 5 spacing 1.85 font ",16" width -1.0
plot [0:500] 'Test.dat' u 1:2 w points pt 1 ps 1.5 lt -1 title "-0.20 V", \
'' u 3:4 w points pt 2 ps 1.5 lt -1 title "-0.50 V", \
'' u 5:6 w points pt 3 ps 1.5 lt -1 title "-0.60 V", \
'' u 7:8 w points pt 4 ps 1.5 lt -1 title "-0.80 V", \
'' u 9:10 w l ls 6 title "Fit", \
'' u 11:12 w l ls 6 notitle, \
'' u 13:14 w l ls 6 notitle, \
'' u 15:16 w l ls 6 notitle
The plot looks fine. Now, the data file, the last column (17th column) is the frequency at which the data sets were acquired in an impedance measurement. That is, Col 1:2 at -0.20 v, Col 3:4 at -0.50 V and so on (first 8 columns are experimental data) were recorded in a specific frequency range (3000-10 Hz). Columns 9 to 16 corresponds to non-linear fits to each data set and as one see, the fit is good.
Now, I wish to label each data set (1:2, 3:4, 5:6, 7:8) with the frequency but with a condition that every 10th frequency should be labelled to the specific data point after rounding it off. How can I revise the script and automate this in Gnuplot? I have provided a small data set, the actual data set is very large.
There is the plotting style with labels (check help labels) and check help every to plot every 10th datapoint (label).
As you can see in your case, towards zero the labels are getting too dense. So, you might think about another way to organize these labels (e.g. log-log-plot or even less than every 10th label, ...)
Code: (to be added)
set style textbox opaque
plot
# ...your original plot command code...
'' u 1:2:(sprintf("%.0f",$17)) every 10::9 w labels offset 0,1 boxed notitle, \
'' u 3:4:(sprintf("%.0f",$17)) every 10::9 w labels offset 0,1 boxed notitle, \
'' u 5:6:(sprintf("%.0f",$17)) every 10::9 w labels offset 0,1 boxed notitle, \
'' u 7:8:(sprintf("%.0f",$17)) every 10::9 w labels offset 0,1 boxed notitle
Result:

why only the first row of data was plotted [GNUPlot]

I have a data file data.txt, and data are as follows.
352 0.523240374 0.522909505 0.523471053
450 0.521095585 0.518197521 0.521120231
571 0.514979782 0.517518353 0.517105300
856 0.517216354 0.517600585 0.515035365
1259 0.514126520 0.514697120 0.514651830
2302 0.510628639 0.510990627 0.511418731
5276 0.507016704 0.507616124 0.505787979
And I wrote a gnuplot script plot.gpl, the code is
set term pdf enhanced font "Sans, 12"
set grid
set xlabel "Num of Cell"
set xrange [0:5500]
set ylabel "Numerical result"
set yrange [0.5:0.53]
set output "pic.pdf"
file = "data.txt"
plot file u 1:2 with linespoints ls 1 lw 0.1 ps 0.4 title "M11",\
file u 1:3 with linespoints ls 2 lw 0.1 ps 0.4 title "M22",\
file u 1:4 with linespoints ls 3 lw 0.1 ps 0.4 title "M33"
Then I typed the command gnuplot plot.gpl, a pdf file was generated, but only the first row of data.txt was plotted.
I tried to modify the format of data.txt, but failed.
Anyone can help me to solve this problem?
PS: Windows 10 Home, MSYS2: Mingw-w64 64 bit, gnuplot 5.2.0
For the sake of not letting this question appear unanswered. I guess according to SO "rules": no answers in comments.
Looks like you only have one line of data. Do you maybe have a text file which has been created on MacOS? Could you check your line end character? Is it \n (LF) (Linux) or \r\n (CR LF) (Windows) or \r (CR) (MacOs)? In the latter case you would get only the first row like you get.

store commented value from data file in gnuplot

I have multiple data files output_k, where k is a number. The files look like
#a=1.00 b = 0.01
# mass mean std
0.2 0.0163 0.0000125
0.4 0.0275 0.0001256
Now I need to retrieve the values of a and b and to store them in a variable, so I can use them for the title or function input etc. The looping over the files in the folder works. But I need some help with reading out the the parameters a and b. This is what i have so far.
# specify the number of plots
plot_number = 100
# loop over all data files
do for [i=0:plot_number] {
a = TODO
b = TODO
#set terminal
set terminal postscript eps size 6.4,4.8 enhanced color font 'Helvetica,20' linewidth 2
set title "Measurement \n{/*0.8 A = a, B = b}"
outFile=sprintf("plot_%d.eps", i)
dataFile=sprintf("output_%d.data", i)
set output outFile
plot dataFile using 1:2:3 with errorbars lt 1 linecolor "red", f(a,b)
unset output
}
EDIT:
I am working with gnuplot for windows.
If you are on a Unixoid system, you can use system to get the output of standard command line tools, namely head and sed, which again allow to extract said values form the files:
a = system(sprintf("head -n 1 output_%i.data | sed \"s/#a=//;s/ b .*//\"", i))
b = system(sprintf("head -n 1 output_%i.data | sed \"s/.*b = //\"", i))
This assumes that the leading spaces to all lines in your question are actually a formatting mistake.
A late answer, but since you are working under Windows you either install the comparable utilities or you might be interested in a gnuplot-only solution (hence platform-independent).
you can use stats to extract information from the datablock (or file) to variables. Check help stats.
the extraction of your a and b depends on the exact structure of that line. You can split a line at spaces via word(), check help word and get substrings via substr() or indexing, check help substr.
Script: (works with gnuplot>=5.0.0)
### extract information from commented header without external tools
reset session
$Data <<EOD
#a=1.00 b = 0.01
# mass mean std
0.2 0.0163 0.0000125
0.4 0.0275 0.0001256
EOD
set datafile commentschar ''
set datafile separator "\t"
stats $Data u (myHeader=strcol(1)[2:]) every ::0::0 nooutput
set datafile commentschar # reset to default
set datafile separator # reset to default
a = real(word(myHeader,1)[3:])
b = real(word(myHeader,4))
set label 1 at graph 0.1,0.9 sprintf("a=%g\nb=%g",a,b)
plot $Data u 1:2 w lp pt 7 lc "red"
### end of script
Result:

How plot graph with missing data lines?

I have data recorded in time. But some data lines are missing and gnuplot replace them with long lines in these intervals.
How can i set gnuplot to draw nothing instead of draw lines in these intervals?
PS. I don't have free cells in these lines, I dont have these lines at all.
lines:
column 1 ... col 195
13:30:20.8 0.78061899
13:30:21.8 5.969546498
13:32:19.8 17.21257881
13:32:20.8 6.922475345
If you don't want to draw a line between two points you must insert an empty line in the data file between the two point entries, so that effectively you have
13:30:20.8 0.78061899
13:30:21.8 5.969546498
13:32:19.8 17.21257881
13:32:20.8 6.922475345
This cannot be done with gnuplot directly, but you can use e.g. awk to do the processing on-the-fly:
set timefmt '%H:%M:%S'
set xdata time
filename = 'data.txt'
plot 'awk ''{split($1,d,":"); t_prev = t; t = (d[1] * 60 + d[2])*60 + d[3]; if (t_prev && (t - t_prev > 10)) print ""; print }'' '.filename with lines
Here, the gap threshold is 10 seconds.
I suppose your miss data identifier is "NaN", then you can use the following command
plot "data" using 1:($2) with linespoints
instead of
plot "data" using 1:2 with linespoints
The former one will ignore the missing data and treat it as blank line and therefore not draw a connecting line across the gap while the latter one will draw continuous, unbroken line.
Just for the records: there are later questions about the same/similar issue.
Avoid connection of points when there is empty data
How to remove line between "jumping" values, in gnuplot?
Removing vertical lines due to sudden jumps in gnuplot
However, my solutions there require transparent color, which was not available in at the time of OP's question (gnuplot 4.6.5, Feb 2014). Nevertheless, there is a solution without external tools like awk or changing the data.
First solution for gnuplot 4.6.: Instead of a transparent line you use a white line which, however, will cover the grid lines, although it will be hardly visible.
Second solution for gnuplot 4.6 is using vectors. This really interrupts the line and will work for gnuplot 5.x as well.
Data:
00:00:00 0.406406
00:00:44 0.339779
00:01:28 0.986602
00:02:13 0.17746
00:02:57 0.0580277
00:03:42 0.586614
00:04:26 0.84247
00:05:11 0.597502
00:05:55 0.0394846
00:06:40 0.369416
00:13:20 0.527109
00:13:42 0.371411
00:14:04 0.851465
00:14:26 0.980312
00:14:48 0.431391
00:15:11 0.545491
00:15:33 0.708445
00:15:55 0.861669
00:16:17 0.277122
00:16:40 0.787273
Script:
### avoid showing a line across larger time gaps
reset
FILE = "SO26510245.dat"
myFmt = "%H:%M:%S"
tGap = 60 # 60 seconds
set format x "%H:%M"
set timefmt "%H:%M:%S"
set xdata time
set ytics 0.5
set key top center noautotitle
set grid x,y
set multiplot layout 3,1
plot FILE u 1:2 w l lc rgb "red" ti "data as is"
myColor(col) = (t0=t1, t1=timecolumn(1), t1-t0>tGap ? 0xffffff : 0x0000ff)
plot t1=NaN FILE u 1:2:(myColor(1)) w l lc rgb var ti "white line"
myGap(col) = (t1-t0>tGap ? NaN : y0)
plot t1=y1=NaN FILE u (t0=t1,t1=timecolumn(1),t0):(y0=y1,y1=$2,myGap(0)):(t1-t0):(y1-y0) \
w vec lc rgb "web-green" nohead ti "with vectors"
unset multiplot
### end of script
Result: (created with gnuplot 4.6.0, from March 2012)

How to fix ';' expected error in gnuplot

I am using ubuntu 14.04, gnuplot 4.6 patchlevel 4.
I have the following script, named Plot.script:
## GNUPLOT command file
set terminal postscript color
set style data lines
set noxzeroaxis
set noyzeroaxis
set key top spacing .8
set size ratio 0.821894871074622
set noxtics
set noytics
set title 'Combined DET Plot'
set ylabel 'Miss probability (in %)'
set xlabel 'False Alarm probability (in %)'
set grid
set pointsize 3
set ytics (\
'5' -1.6449, '10' -1.2816, '20' -0.8416, '40' -0.2533, '60' 0.2533, \
'80' 0.8416, '90' 1.2816, '95' 1.6449, '98' 2.0537)
set xtics (\
'.0001' -4.7534, '.001' -4.2649, '.004' -3.9444, '.01' -3.7190, '.02' -3.5401, \
'.05' -3.2905, '.1' -3.0902, '.2' -2.8782, '.5' -2.5758, '1' -2.3263, \
'2' -2.0537, '5' -1.6449, '10' -1.2816, '20' -0.8416, '40' -0.2533)
plot [-4.75343910607888:-0.253347103317183] [-1.64485362793551:2.05374890849825] \
-x title 'Random Performance' with lines 1,\
'tmp/score.det.sub00.dat.1' using 3:2 title 'Term Wtd. fake : ALL Data Max Val=0.267 Scr=0.436' with lines 2,\
'tmp/score.det.sub00.dat.2' using 6:5 notitle with points 2,\
'tmp/score.det.sub01.dat.1' using 3:2 title 'Term Wtd. fake: CTS Subset Max Val=0.267 Scr=0.436' with lines 3,\
'tmp/score.det.sub01.dat.2' using 6:5 notitle with points 3
Then I run gnuplot Plot.script | ps2pdf - .
I get the following error:
line 27: ';' expected
line 27 is the last row of the script:
'tmp/score.det.sub01.dat.2' using 6:5 notitle with points 3
I have searched from web and found this similar question but it doesn't seem to help. Does anyone know what the problem is?
In general it is very hard to debug such a long script, especially without having the test data to run exactly this script. You should start by cutting down your script line by line to track down in which line the error really appears. The whole plot command is treated as a single line, so if it says line 27, the error can also appear earlier.
I guess, that you have the wrong syntax for selecting line types. Using with lines 1 doesn't work, and the simple line
plot x with lines 1
already shows this error. You must use
plot x with lines linetype 1
Accordingly you must fix all other positions where you set a line type (or point type).
line 27: ';' expected
can mean there's a ',' missing in the plot statement. I couldn't find it myself in your code. May be you need to delete blanks before "Scr="
But I had a similar problem.

Resources