Managing labels of specific points at equal spacing in Gnuplot - 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:

Related

Same increment, same axis length but different x and y ranges in Gnuplot

My test data is given below
# Test data
0.02952 0.00964 6998.41996 0.03072 0.01139 0.04932 0.01484 6998.41996 0.05043 0.01643 0.04709 0.00679 6998.41996 0.04837 0.00871 0.04681 0.00635 6998.41996 0.04805 0.00812 0.0461 0.00527 6998.41996 0.04703 0.0071
0.02993 0.01074 6441.69266 0.03103 0.01222 0.04986 0.01626 6441.69266 0.05087 0.01763 0.04738 0.00769 6441.69266 0.04861 0.00934 0.04714 0.00721 6441.69266 0.04827 0.00871 0.04633 0.00603 6471.42616 0.04722 0.00759
0.03041 0.0119 5929.25325 0.03137 0.0131 0.05054 0.01783 5929.25325 0.05137 0.0189 0.04778 0.00865 5929.25325 0.04888 0.01002 0.04767 0.00838 5929.25325 0.04852 0.00935 0.04663 0.00678 5984.11595 0.04743 0.00811
0.03098 0.01305 5457.57861 0.03175 0.01405 0.05119 0.01936 5457.57861 0.05193 0.02026 0.04819 0.00961 5457.57861 0.04916 0.01073 0.04815 0.00934 5457.57861 0.04878 0.01002 0.04696 0.00755 5533.50109 0.04765 0.00866
0.03163 0.01432 5023.4259 0.03217 0.01505 0.05191 0.02105 5023.4259 0.05254 0.02171 0.04887 0.01063 5023.4259 0.04949 0.0115 0.04859 0.01029 5023.4259 0.04909 0.01075 0.04729 0.00831 5116.81836 0.04791 0.00924
0.032 0.01547 4623.81021 0.03264 0.01612 0.05269 0.02276 4623.81021 0.05323 0.02325 0.04899 0.01155 4623.81021 0.04985 0.01231 0.04908 0.01125 4623.81021 0.04943 0.01151 0.04765 0.00914 4731.51259 0.0482 0.00985
0.03297 0.01698 4255.98413 0.03316 0.01725 0.05409 0.02444 4255.98413 0.05399 0.02488 0.04948 0.01255 4255.98413 0.05025 0.01317 0.04962 0.01216 4255.98413 0.04981 0.01233 0.04804 0.00988 4375.22105 0.04851 0.0105
0.03336 0.0181 3917.41877 0.03374 0.01845 0.05454 0.02638 3917.41877 0.05485 0.0266 0.05022 0.01364 3917.41877 0.0507 0.01408 0.04997 0.01295 3917.41877 0.05023 0.01319 0.04856 0.01078 4045.75892 0.04886 0.01119
0.03424 0.01958 3605.78643 0.03439 0.01973 0.05554 0.02842 3605.78643 0.0558 0.02843 0.05083 0.01471 3605.78643 0.0512 0.01504 0.05059 0.01395 3605.78643 0.0507 0.0141 0.04901 0.01167 3741.10588 0.04925 0.01191
0.03516 0.02102 3318.94458 0.03511 0.02107 0.05675 0.03035 3318.94458 0.05685 0.03036 0.05153 0.01581 3318.94458 0.05175 0.01607 0.0513 0.015 3318.94458 0.05123 0.01506 0.04953 0.01258 3459.39378 0.04967 0.01267
0.03612 0.02247 3054.92111 0.03592 0.02249 0.05834 0.03203 3054.92111 0.05804 0.0324 0.05235 0.01697 3054.92111 0.05237 0.01714 0.05186 0.01617 3054.92111 0.05181 0.01608 0.05011 0.01353 3191.53786 0.05014 0.01346
0.03718 0.02411 2811.90083 0.0368 0.02397 0.05955 0.03468 2811.90083 0.05935 0.03452 0.05319 0.01818 2811.90083 0.05305 0.01827 0.05253 0.01711 2811.90083 0.05246 0.01715 0.05074 0.01439 2951.20923 0.05066 0.01429
0.03818 0.02559 2588.21292 0.0378 0.02553 0.06121 0.03693 2588.21292 0.0608 0.03675 0.0541 0.01946 2588.21292 0.0538 0.01945 0.05362 0.01833 2588.21292 0.05319 0.01826 0.05143 0.01534 2728.97778 0.05124 0.01517
0.03942 0.02723 2382.31947 0.0389 0.02716 0.06298 0.0393 2382.31947 0.06241 0.03908 0.05507 0.0207 2382.31947 0.05464 0.02068 0.05413 0.01937 2382.31947 0.054 0.01942 0.05213 0.01622 2523.48077 0.05187 0.01607
0.04078 0.02895 2192.80494 0.04011 0.02885 0.06494 0.04169 2192.80494 0.06421 0.04149 0.05607 0.02198 2192.80494 0.05557 0.02196 0.05514 0.02056 2192.80494 0.05489 0.02062 0.05291 0.01718 2333.45806 0.05258 0.017
0.04239 0.03073 2018.36636 0.04146 0.03061 0.06707 0.04418 2018.36636 0.06618 0.04399 0.05722 0.02328 2018.36636 0.0566 0.02329 0.05643 0.02189 2018.36636 0.05588 0.02187 0.05377 0.01821 2157.74441 0.05335 0.01797
0.0442 0.03265 1853.53162 0.04294 0.03242 0.06911 0.04671 1853.53162 0.06837 0.04657 0.05849 0.02461 1853.53162 0.05773 0.02466 0.05743 0.02311 1853.53162 0.05698 0.02315 0.05474 0.01921 1995.26231 0.0542 0.01895
0.04562 0.03421 1706.08239 0.04458 0.03427 0.07185 0.04927 1706.08239 0.07076 0.04919 0.0598 0.02593 1706.08239 0.05897 0.02607 0.05862 0.02425 1706.08239 0.05818 0.02446 0.05574 0.02015 1845.01542 0.05513 0.01997
0.04744 0.03597 1570.3628 0.04638 0.03617 0.07448 0.05177 1570.3628 0.0734 0.05187 0.06122 0.02739 1570.3628 0.06034 0.02751 0.06 0.02549 1570.3628 0.0595 0.02579 0.05679 0.0212 1706.08239 0.05615 0.021
0.04951 0.03782 1445.43977 0.04834 0.03809 0.07739 0.05433 1445.43977 0.07627 0.05457 0.0627 0.02867 1445.43977 0.06182 0.02896 0.06152 0.0269 1445.43977 0.06095 0.02713 0.05799 0.02222 1577.61127 0.05724 0.02204
0.05171 0.03966 1330.45442 0.05049 0.04004 0.08065 0.05713 1330.45442 0.0794 0.05729 0.06437 0.03012 1330.45442 0.06346 0.03042 0.06314 0.02807 1330.45442 0.06253 0.02847 0.05928 0.02328 1458.81426 0.05845 0.02307
0.05393 0.04128 1224.6162 0.05282 0.04197 0.08413 0.05955 1224.6162 0.08281 0.05998 0.06618 0.03152 1224.6162 0.06522 0.03189 0.06527 0.02944 1224.6162 0.06425 0.0298 0.05972 0.0236 1348.96288 0.05974 0.02411
0.05666 0.04317 1127.19746 0.05535 0.04388 0.08748 0.06138 1127.19746 0.08648 0.06263 0.06816 0.03281 1127.19746 0.06713 0.03333 0.0667 0.03056 1127.19746 0.0661 0.0311 0.06175 0.0251 1247.38351 0.06115 0.02513
0.05932 0.04509 1037.52842 0.05806 0.04574 0.0918 0.06524 1037.52842 0.09043 0.06519 0.07027 0.03414 1037.52842 0.06919 0.03475 0.06888 0.03189 1037.52842 0.06808 0.03237 0.06353 0.02603 1153.45326 0.06264 0.02612
0.06225 0.04668 954.99259 0.06097 0.04755 0.09596 0.06681 954.99259 0.09464 0.06766 0.07236 0.03541 954.99259 0.07138 0.03612 0.07082 0.03292 954.99259 0.0702 0.03356 0.06505 0.02698 1066.59612 0.06424 0.02708
0.06517 0.04821 879.02252 0.06406 0.04928 0.09993 0.06878 879.02252 0.09912 0.06999 0.07457 0.03664 879.02252 0.07372 0.03743 0.07297 0.03389 879.02252 0.07245 0.03469 0.06674 0.02784 986.27949 0.06594 0.02798
0.06837 0.04967 809.0959 0.06735 0.05089 0.10443 0.07091 809.0959 0.10381 0.07214 0.07697 0.03779 809.0959 0.0762 0.03866 0.07543 0.03496 809.0959 0.07482 0.03572 0.06848 0.02859 912.01084 0.06773 0.02882
0.07145 0.05112 744.73197 0.0708 0.05238 0.10997 0.07277 744.73197 0.10884 0.07409 0.07931 0.03914 744.73197 0.07881 0.03979 0.07775 0.03589 744.73197 0.07731 0.03665 0.07015 0.02913 841.39514 0.06961 0.0296
0.07514 0.0525 685.48823 0.0744 0.05371 0.11398 0.07457 685.48823 0.11398 0.07582 0.08213 0.03987 685.48823 0.08153 0.04082 0.08056 0.03682 685.48823 0.0799 0.03745 0.07214 0.02995 778.03655 0.07157 0.03029
0.07846 0.05346 630.95734 0.07815 0.05487 0.11808 0.07749 630.95734 0.11932 0.07729 0.08473 0.04055 630.95734 0.08435 0.04171 0.08311 0.03766 630.95734 0.08256 0.03813 0.07413 0.03059 719.44898 0.0736 0.0309
0.08225 0.05446 580.76442 0.08201 0.05585 0.12414 0.07791 580.76442 0.12476 0.07848 0.08766 0.0415 580.76442 0.08727 0.04247 0.08574 0.0383 580.76442 0.08529 0.03865 0.0762 0.03098 665.27316 0.0757 0.03139
0.08615 0.05561 534.56436 0.08596 0.05663 0.1301 0.07893 534.56436 0.1304 0.07938 0.0904 0.04235 534.56436 0.09025 0.04308 0.08814 0.0389 534.56436 0.08806 0.03903 0.07831 0.03146 615.17687 0.07784 0.03178
0.09021 0.05617 492.03954 0.08997 0.05719 0.13544 0.07942 492.03954 0.13605 0.07998 0.0935 0.04295 492.03954 0.09328 0.04354 0.09105 0.03915 492.03954 0.09086 0.03925 0.08017 0.03178 568.85293 0.08001 0.03206
0.09373 0.05673 452.89758 0.09401 0.05754 0.14396 0.08375 452.89758 0.1417 0.08028 0.09647 0.04343 452.89758 0.09634 0.04384 0.09419 0.03944 452.89758 0.09366 0.03932 0.08222 0.03207 526.01727 0.08221 0.03221
0.09803 0.0571 416.86938 0.09806 0.05769 0.14663 0.07984 416.86938 0.14735 0.08028 0.0993 0.04338 416.86938 0.0994 0.04399 0.09673 0.03943 416.86938 0.09644 0.03923 0.08449 0.03232 486.40721 0.08439 0.03225
0.10197 0.05731 383.70725 0.10209 0.05762 0.15125 0.0799 383.70725 0.15289 0.07998 0.10242 0.0438 383.70725 0.10243 0.04398 0.09912 0.03957 383.70725 0.09918 0.03901 0.08301 0.02946 449.77985 0.08658 0.03218
0.10566 0.05509 353.18317 0.10607 0.05736 0.16665 0.08047 353.18317 0.15844 0.07941 0.10607 0.04421 353.18317 0.10545 0.04381 0.10172 0.04029 353.18317 0.10186 0.03865 0.08819 0.03179 415.91061 0.08874 0.032
0.10997 0.05691 325.0873 0.10997 0.05691 0.16141 0.08017 325.0873 0.16378 0.07859 0.10833 0.04355 325.0873 0.10843 0.04353 0.10484 0.03917 325.0873 0.10443 0.03817 0.09017 0.03157 384.59178 0.09085 0.03171
0.11377 0.05691 299.22646 0.11377 0.05628 0.16922 0.07903 299.22646 0.16901 0.07754 0.11202 0.04329 299.22646 0.11131 0.04311 0.10689 0.03842 299.22646 0.10699 0.03758 0.09266 0.03127 355.63132 0.09292 0.03133
0.11767 0.05615 275.42287 0.11747 0.05551 0.17353 0.07787 275.42287 0.17394 0.07631 0.11398 0.04274 275.42287 0.11408 0.04257 0.10946 0.03774 275.42287 0.10946 0.03689 0.09476 0.03164 328.85163 0.09491 0.03085
0.12168 0.05538 253.51286 0.12096 0.05461 0.17846 0.07675 253.51286 0.17877 0.07491 0.11634 0.0429 253.51286 0.11675 0.04195 0.11285 0.03736 253.51286 0.11172 0.03613 0.09679 0.03081 304.0885 0.09684 0.0303
0.12517 0.05473 232.80913 0.12435 0.0536 0.18431 0.07453 232.80913 0.18339 0.07337 0.11952 0.04162 232.80913 0.11942 0.04123 0.11428 0.0362 232.80913 0.11398 0.03531 0.09834 0.0299 281.19008 0.09869 0.02967
0.12845 0.05358 214.28906 0.12763 0.0525 0.18503 0.07043 214.28906 0.1878 0.07172 0.1226 0.04084 214.28906 0.12188 0.04046 0.11716 0.03502 214.28906 0.11603 0.03444 0.09968 0.02942 260.01596 0.10045 0.029
0.13205 0.05237 197.24227 0.13071 0.05134 0.1915 0.07037 197.24227 0.19191 0.07 0.12394 0.03993 197.24227 0.12424 0.03963 0.1189 0.03488 197.24227 0.11798 0.03355 0.10139 0.02871 239.88329 0.10213 0.02829
0.13585 0.05077 181.55157 0.13359 0.05014 0.19592 0.06969 181.55157 0.19592 0.06824 0.12732 0.03886 181.55157 0.1265 0.03878 0.11849 0.03304 181.55157 0.11983 0.03263 0.10381 0.0279 221.81964 0.10371 0.02753
0.13831 0.05007 167.10906 0.13636 0.04892 0.19889 0.06667 167.10906 0.19961 0.06647 0.12999 0.03829 167.10906 0.12866 0.03791 0.12147 0.03146 167.10906 0.12157 0.03172 0.10566 0.02702 205.11622 0.10525 0.02676
0.14303 0.04758 153.81546 0.13903 0.04769 0.20177 0.06753 153.81546 0.2031 0.06469 0.13112 0.03896 153.81546 0.13071 0.03704 0.12342 0.03227 153.81546 0.12322 0.0308 0.10792 0.02548 189.67059 0.10658 0.02598
0.14355 0.04769 141.57938 0.14149 0.04647 0.2107 0.06523 141.57938 0.20639 0.06295 0.13379 0.03653 141.57938 0.13256 0.03616 0.12383 0.02983 141.57938 0.12476 0.02992 0.10956 0.02459 175.38805 0.10792 0.02519
0.14653 0.04559 130.31668 0.14386 0.04528 0.21265 0.05532 130.31668 0.20947 0.06125 0.13687 0.03557 130.31668 0.13441 0.03531 0.12774 0.02789 130.31668 0.1263 0.02906 0.10915 0.02405 162.18101 0.10925 0.0244
0.1493 0.04481 119.94993 0.14601 0.04412 0.21173 0.0577 119.94993 0.21245 0.05962 0.13862 0.03374 119.94993 0.13616 0.03449 0.12589 0.02592 119.94993 0.12763 0.02823 0.11747 0.02416 149.96848 0.11038 0.02363
Gnuplot script is given below
##
##
#
reset session
##
##
set terminal postscript eps enhanced colour font 'Times-Bold,12' size 4in,4in
set output "test.eps"
set style line 6 lt 6 lw 5 lc rgb "#000FF"
set xtics out scale 1.5
set ytics out scale 1.5
set tics font ", 16"
set xlabel "{/Times-Italic Z}_{Re} (m{/Symbol \127}. cm^{-2})" font ",16"
set ylabel "{/Times-Italic -Z}_{Im} (m{/Symbol \127}. cm^{-2})" font ",16"
set key spacing 1.15 font ",14" width -1.0
set xtics 20
set ytics 20
set yrange [0:100]
set key inside left top
plot [0:220] 'test.dat' u ($1*1000):($2*1000) w points pt 4 ps 1.50 lt -1 title "-1.40 V", \
'' u ($6*1000):($7*1000) w points pt 6 ps 1.50 lt -1 title "-1.25 V", \
'' u ($11*1000):($12*1000) w points pt 8 ps 1.50 lt -1 title "-1.20 V", \
'' u ($16*1000):($17*1000) w points pt 10 ps 1.50 lt -1 title "-1.10 V", \
'' u ($21*1000):($22*1000) w points pt 12 ps 1.50 lt -1 title "-1.00 V", \
'test.dat' u ($4*1000):($5*1000) w l ls 6 title "Fit", \
'' u ($9*1000):($10*1000) w l ls 6 notitle, \
'' u ($14*1000):($15*1000) w l ls 6 notitle, \
'' u ($19*1000):($20*1000) w l ls 6 notitle, \
'' u ($24*1000):($25*1000) w l ls 6 notitle, \
'test.dat' u ($1*1000):($2*1000):(sprintf("%.0f",$3)) every 25::24 w labels offset 0,-1.75 boxed notitle, \
'' u ($6*1000):($7*1000):(sprintf("%.0f",$8)) every 25::24 w labels offset 0,-1.75 boxed notitle, \
'' u ($11*1000):($12*1000):(sprintf("%.0f",$13)) every 25::24 w labels offset 0,-1.75 boxed notitle, \
'' u ($16*1000):($17*1000):(sprintf("%.0f",$18)) every 25::24 w labels offset 0,-1.75 boxed notitle, \
'' u ($21*1000):($22*1000):(sprintf("%.0f",$23)) every 25::24 w labels offset 0,-1.75 boxed notitle, \
#
Plotting is ok but I wish to have the same length of axis for 0 to 20 in both x and y axis. That is, although the increment of xtics and ytics is same, the length is not same. Since this is one of the requirements of plotting complex impedance data, any suggestions would be helpful. Thanks,
You set the yrange to [0:100]. And your plotting the xrange [0:220]. First, I would set the xrange via
set xrange[0:220]
And add the line
set size ratio -1
Check help size.
...The meaning of a negative value for is different. If =-1,
gnuplot tries to set the scales so that the unit has the same length
on both the x and y axes.
gnuplot> help set view equal
The command `set view equal xy` forces the unit length of the x and y axes
to be on the same scale, and chooses that scale so that the plot will fit on
the page. The command `set view equal xyz` additionally sets the z axis
scale to match the x and y axes; however there is no guarantee that the
current z axis range will fit within the plot boundary.
By default all three axes are scaled independently to fill the available area.

gnuploting curve filled maps

I want to get a map using gnuplot like map1.
There are my code and part of the data.When I do set set timefmt "%Y/%m/%d/%h" set xdata time``set format x "%m/%d", it responded error in map2. I didn't know how to figure out it. Hope you can help me.
set style data lines
set style fill solid 1.00 noborder
set boxwidth 0.75 absolute
unset ylabel
unset xlabel
unset xtics
set origin 0.050, 0.300
unset ylabel
#set timefmt "%Y/%m/%d/%h"
#set xdata time
#set format x "%m/%d"
set ytics nomirror font ",11"
set style increment default
set xtics nomirror norangelimit
set ytics 0,80,320
set size 0.9,0.9
set size ratio 0.4
unset key
plot [][0:320]'average.shijiazhua.ch36km.2020.NSA_total.ts' using 1:(0):(\$2) w filledcu axis x1y1 lc rgb "#EF476F" t "Power",\
'' using 1:(\$2):(\$2+\$3) w filledcu lc rgb "#8ac926" t "Industry",\
'' using 1:(\$2+\$3):(\$2+\$3+\$4) w filledcu lc rgb "#1982c4" t "Agriculture",\
'' using 1:(\$2+\$3+\$4):(\$2+\$3+\$4+\$5) w filledcu t "Residential",\
'' using 1:(\$2+\$3+\$4+\$5):(\$2+\$3+\$4+\$5+\$6) w filledcu lc rgb "#c77dff" t "Transportation"
Data:
2020050500 34.92820 33.47148 69.01359 8.37408 36.82053
2020050501 34.14014 31.02070 68.22377 8.03866 35.97493
2020050502 32.93465 28.59794 66.69872 7.79872 34.76229
2020050503 31.56261 26.31655 64.97402 7.60045 33.42817
2020050504 29.55138 23.19680 61.65179 7.20578 31.10942
2020050505 28.45511 21.41614 60.70938 7.15501 29.97279
2020050506 28.78439 21.22073 63.38977 7.55193 30.63113
2020050507 28.32452 20.49873 64.72398 7.80252 30.85250
2020050508 25.49913 18.48231 60.84341 7.72398 29.33283
2020050509 19.03617 14.95413 49.02392 7.68153 23.93946
2020050510 14.25507 12.42948 39.15635 7.59906 19.45655
2020050511 11.56549 10.86627 33.26527 7.08790 16.58210
2020050512 10.40714 10.28374 30.64410 6.73005 15.23610
2020050513 9.99347 10.23459 30.32369 6.50979 15.00718
2020050514 9.77059 10.03319 30.06268 6.34308 14.90386
2020050515 9.46511 9.68426 28.68079 6.15453 14.22397
2020050516 9.12669 9.52622 27.02652 6.12770 13.46605
2020050517 8.94960 9.70764 26.01473 6.21285 12.75945
2020050518 8.30828 9.19368 23.64348 5.64860 11.42775
2020050519 6.98423 7.77228 19.39676 4.56069 9.39085
2020050520 5.81946 6.37644 15.79359 3.60976 7.73696
2020050521 5.36498 5.64128 14.26162 3.11704 7.00662
2020050522 5.18471 5.20392 13.71013 2.84699 6.70183
2020050523 4.96575 4.67512 13.20869 2.56693 6.34549
2020050600 4.80342 4.29339 12.99936 2.36875 6.11740
2020050601 4.57129 3.82130 12.45918 2.13018 5.80136
2020050602 4.62375 3.69038 12.84608 2.07090 5.95253
2020050603 4.89624 3.78565 13.95552 2.15729 6.42439
2020050604 5.11386 3.70182 14.69319 2.17235 6.70257
2020050605 5.32001 3.66094 15.21974 2.19411 6.86478
2020050606 5.51991 3.87873 15.74852 2.32875 7.07490
2020050607 5.67472 4.34660 16.24980 2.56207 7.47552
2020050608 7.11860 7.23675 22.40004 3.77179 10.82728
2020050609 7.91739 8.27180 24.90193 4.18627 12.04413
2020050610 8.40120 8.44643 25.63029 4.42067 12.51950
2020050611 8.78894 8.91031 26.46757 4.79258 13.22055
2020050612 8.75023 9.05808 25.82002 5.18174 13.31731
2020050613 8.69377 9.18953 25.18435 5.58854 13.35642
2020050614 8.67938 9.23050 24.79873 5.81155 13.34736
2020050615 8.61072 9.05110 24.20865 5.83554 13.13042
2020050616 8.61898 9.38255 24.24635 6.02599 13.15560
2020050617 9.88121 12.44088 28.35582 7.22637 15.13754
2020050618 13.03567 17.87587 35.27399 8.69368 18.69806
2020050619 17.21906 22.73761 41.73368 9.50554 22.38980
2020050620 22.06430 26.93686 48.36322 10.13785 26.27978
2020050621 27.02551 30.15065 54.72841 10.65425 30.01287
2020050622 29.04600 30.14368 57.09066 10.54669 31.39031
2020050623 28.72626 28.07003 56.50034 10.02480 30.99561
2020050700 28.97064 26.99266 57.29614 9.75325 31.34316
2020050701 29.37847 26.09241 57.38815 9.41128 31.39288
2020050702 29.04029 23.62373 54.13726 8.71631 29.70628
2020050703 26.91615 19.50575 47.41990 7.68835 26.01030
2020050704 22.78487 15.26919 39.35748 6.38515 21.32836
2020050705 15.26723 10.62037 27.09076 5.20689 14.57554
2020050706 8.87406 7.55900 17.58181 4.93560 9.53557
2020050707 6.11438 6.48395 14.25941 5.27410 7.86598
2020050708 4.67842 5.50418 12.43140 5.45161 7.09094
2020050709 3.64316 4.24208 10.22776 5.41426 6.11685
2020050710 3.17714 3.64387 8.92585 5.55745 5.67752
2020050711 3.20047 3.70725 8.78954 5.71015 5.83647
2020050712 3.50073 4.00986 9.26960 5.64515 6.21379
2020050713 3.59172 4.10384 9.19951 5.44214 6.23010
2020050714 3.32714 3.86352 8.31776 4.95656 5.70188
2020050715 2.92304 3.50896 7.19465 4.30262 4.96345
2020050716 2.61181 3.36959 6.41498 3.78693 4.42651
2020050717 2.77914 4.12923 6.82416 3.69544 4.57126
2020050718 4.21519 6.94777 9.53290 4.03701 6.17134
2020050719 6.95361 11.13112 14.64627 4.72538 9.09068
2020050720 10.43964 15.30013 21.20108 5.65491 12.65777
2020050721 13.85205 18.44100 27.72278 6.57799 16.04925
2020050722 16.65494 20.41442 33.30551 7.37484 18.98996
2020050723 18.98237 21.99487 38.32611 8.08933 21.69509
2020050800 21.45151 23.63957 42.98992 8.55449 24.35935
I'm not sure whether this question is fully answered.
I cleaned up your code a little. I don't know why you used \$2. If you put the below code into a text file and load this text file to gnuplot it should work.
Edit: to make the plot command a bit shorter and more clear you can:
define a function myTime(col) = timecolumn(col,myTimeFmt)
instead of filling the area between 2 curves, fill the area between a curve and the x-axis, but start with the upper curve.
why do you unset key? don't you want a legend?
Code:
### filledcurves and time data
reset session
$Data <<EOD
2020050500 34.92820 33.47148 69.01359 8.37408 36.82053
2020050501 34.14014 31.02070 68.22377 8.03866 35.97493
2020050502 32.93465 28.59794 66.69872 7.79872 34.76229
2020050503 31.56261 26.31655 64.97402 7.60045 33.42817
2020050504 29.55138 23.19680 61.65179 7.20578 31.10942
2020050505 28.45511 21.41614 60.70938 7.15501 29.97279
2020050506 28.78439 21.22073 63.38977 7.55193 30.63113
2020050507 28.32452 20.49873 64.72398 7.80252 30.85250
2020050508 25.49913 18.48231 60.84341 7.72398 29.33283
2020050509 19.03617 14.95413 49.02392 7.68153 23.93946
2020050510 14.25507 12.42948 39.15635 7.59906 19.45655
2020050511 11.56549 10.86627 33.26527 7.08790 16.58210
2020050512 10.40714 10.28374 30.64410 6.73005 15.23610
2020050513 9.99347 10.23459 30.32369 6.50979 15.00718
2020050514 9.77059 10.03319 30.06268 6.34308 14.90386
2020050515 9.46511 9.68426 28.68079 6.15453 14.22397
2020050516 9.12669 9.52622 27.02652 6.12770 13.46605
2020050517 8.94960 9.70764 26.01473 6.21285 12.75945
2020050518 8.30828 9.19368 23.64348 5.64860 11.42775
2020050519 6.98423 7.77228 19.39676 4.56069 9.39085
2020050520 5.81946 6.37644 15.79359 3.60976 7.73696
2020050521 5.36498 5.64128 14.26162 3.11704 7.00662
2020050522 5.18471 5.20392 13.71013 2.84699 6.70183
2020050523 4.96575 4.67512 13.20869 2.56693 6.34549
2020050600 4.80342 4.29339 12.99936 2.36875 6.11740
2020050601 4.57129 3.82130 12.45918 2.13018 5.80136
2020050602 4.62375 3.69038 12.84608 2.07090 5.95253
2020050603 4.89624 3.78565 13.95552 2.15729 6.42439
2020050604 5.11386 3.70182 14.69319 2.17235 6.70257
2020050605 5.32001 3.66094 15.21974 2.19411 6.86478
2020050606 5.51991 3.87873 15.74852 2.32875 7.07490
2020050607 5.67472 4.34660 16.24980 2.56207 7.47552
2020050608 7.11860 7.23675 22.40004 3.77179 10.82728
2020050609 7.91739 8.27180 24.90193 4.18627 12.04413
2020050610 8.40120 8.44643 25.63029 4.42067 12.51950
2020050611 8.78894 8.91031 26.46757 4.79258 13.22055
2020050612 8.75023 9.05808 25.82002 5.18174 13.31731
2020050613 8.69377 9.18953 25.18435 5.58854 13.35642
2020050614 8.67938 9.23050 24.79873 5.81155 13.34736
2020050615 8.61072 9.05110 24.20865 5.83554 13.13042
2020050616 8.61898 9.38255 24.24635 6.02599 13.15560
2020050617 9.88121 12.44088 28.35582 7.22637 15.13754
2020050618 13.03567 17.87587 35.27399 8.69368 18.69806
2020050619 17.21906 22.73761 41.73368 9.50554 22.38980
2020050620 22.06430 26.93686 48.36322 10.13785 26.27978
2020050621 27.02551 30.15065 54.72841 10.65425 30.01287
2020050622 29.04600 30.14368 57.09066 10.54669 31.39031
2020050623 28.72626 28.07003 56.50034 10.02480 30.99561
2020050700 28.97064 26.99266 57.29614 9.75325 31.34316
2020050701 29.37847 26.09241 57.38815 9.41128 31.39288
2020050702 29.04029 23.62373 54.13726 8.71631 29.70628
2020050703 26.91615 19.50575 47.41990 7.68835 26.01030
2020050704 22.78487 15.26919 39.35748 6.38515 21.32836
2020050705 15.26723 10.62037 27.09076 5.20689 14.57554
2020050706 8.87406 7.55900 17.58181 4.93560 9.53557
2020050707 6.11438 6.48395 14.25941 5.27410 7.86598
2020050708 4.67842 5.50418 12.43140 5.45161 7.09094
2020050709 3.64316 4.24208 10.22776 5.41426 6.11685
2020050710 3.17714 3.64387 8.92585 5.55745 5.67752
2020050711 3.20047 3.70725 8.78954 5.71015 5.83647
2020050712 3.50073 4.00986 9.26960 5.64515 6.21379
2020050713 3.59172 4.10384 9.19951 5.44214 6.23010
2020050714 3.32714 3.86352 8.31776 4.95656 5.70188
2020050715 2.92304 3.50896 7.19465 4.30262 4.96345
2020050716 2.61181 3.36959 6.41498 3.78693 4.42651
2020050717 2.77914 4.12923 6.82416 3.69544 4.57126
2020050718 4.21519 6.94777 9.53290 4.03701 6.17134
2020050719 6.95361 11.13112 14.64627 4.72538 9.09068
2020050720 10.43964 15.30013 21.20108 5.65491 12.65777
2020050721 13.85205 18.44100 27.72278 6.57799 16.04925
2020050722 16.65494 20.41442 33.30551 7.37484 18.98996
2020050723 18.98237 21.99487 38.32611 8.08933 21.69509
2020050800 21.45151 23.63957 42.98992 8.55449 24.35935
EOD
set size 0.9,0.9
set size ratio 0.4
unset xlabel
unset xtics
set xtics nomirror norangelimit
unset ylabel
set ytics nomirror font ",11"
set ytics 0,80,320
myTimeFmt = "%Y%m%d%H"
set format x "%m/%d\n%H:%M" time
set style data lines
set style fill solid 1.00 noborder
set style increment default
myTime(col) = timecolumn(col,myTimeFmt)
plot [][0:320] \
$Data u (myTime(1)):($2+$3+$4+$5+$6) w filledcu x1 lc rgb "#c77dff" t "Transportation", \
'' u (myTime(1)):($2+$3+$4+$5) w filledcu x1 t "Residential",\
'' u (myTime(1)):($2+$3+$4) w filledcu x1 lc rgb "#1982c4" t "Agriculture",\
'' u (myTime(1)):($2+$3) w filledcu x1 lc rgb "#8ac926" t "Industry",\
'' u (myTime(1)):($2) w filledcu x1 lc rgb "#EF476F" t "Power"
### end of code
Result:

Merging two loglog plot in gnuplot

given the following set of data:
0.0010339964703699645 1.1335006374746552e-7 0.0036126270484542334
0.0012221213681267867 1.9921394136413835e-7 0.005261243901795814
0.0014205289558535598 3.288567819970283e-7 0.007425886368281838
0.0017072805793891044 5.09897629791369e-7 0.010481131341546832
0.001984452250029774 8.417246932261471e-7 0.014793400915475614
0.0023455026862141174 0.000001389495494373136 0.020235896477251224
0.002772242492080673 0.0000022937401556835766 0.028561585549968214
0.003276623164863039 0.0000037864418582867756 0.04031272694269899
0.003808572703579145 0.000005870937850692427 0.05344304028586673
0.004426882588756425 0.000009691579392800477 0.07085004591866341
0.005320504478191538 0.000015026946780037802 0.09999999999999795
0.006184271765580915 0.000024806061902520164 0.13679002274643795
0.00743264474795339 0.0000435969173544848 0.20555363918508876
0.008784937113875308 0.00006759770831018738 0.2901249202026803
0.010041876641771868 0.0001115883992507748 0.3727593720314877
0.011868891598451578 0.00018420699693267163 0.5261243901795244
0.014264776540746428 0.0003040837394100148 0.7196856730011411
0.0168601041894875 0.0005019729006676898 1.0157871652296924
0.019927624696285583 0.0008286427728546826 1.4793400915475645
0.023553248637906678 0.0013679002274643991 2.0235896477251267
0.027377045003188133 0.0021209508879201926 2.768068739417809
0.03182162276758441 0.0035012061856667213 3.669660188580873
0.04674029725500457 0.012258444754550964 7.783169035335985
0.062101694189156224 0.02442053094548645 13.679002274643823
0.07158292449880059 0.04159562163071843 18.134408785428295
0.08531678524172823 0.0665471179633392 27.25047957060815
0.10083928648856323 0.10985411419875572 37.27593720314892
0.11721022975334817 0.17033053754470567 49.417133613237674
0.13623894453468574 0.28117686979742307 65.51285568595429
0.16102620275609408 0.46415888336127725 95.40954763499826
0.1935313656264482 0.7662204546142304 138.9495494373119
0.22874238366617797 1.2648552168552907 190.0691202813751
0.27035968002353816 2.222996482526191 268.2695795279694
0.31425172980765415 3.2374575428176398 366.96601885808883
0.3714265618637218 5.34430402858675 501.97290066768466
0.4390037596367272 8.822227063126444 708.5004591866399
0.5188759253192368 14.563484775012384 969.1579392800378
0.5931161449307741 23.29951810515367 1325.7113655900946
0.7248599145008832 39.68619443383435 1930.6977288832318
0.828572105824921 61.53407071116586 2559.54792269951
0.9958297992232203 101.5787165229707 3612.627048453646
1.1770106683368593 178.52567354823375 5098.976297913632
1.41460506489842 276.8068739417843 7425.88636828145
1.6170052641696395 456.9450168789167 9844.581958011371
1.9112025450223642 708.5004591866457 13051.074191219035
2.221480309984754 1169.5726687403355 17852.567354823266
2.6256555351043787 1930.6977288832436 24420.53094548635
3.1556771051918786 3187.141611585059 33404.84983513217
3.667991428805581 5428.6754393238425 45694.50168789148
4.335344299236616 8157.641691281789 66547.11796333866
5.124115079800981 14337.141946186151 91029.81779915153
6.158482110660273 23667.35144725228 136790.02274643906
7.15829244988006 39069.39937054605 199213.9413641371
8.182493376519213 56898.660290182816 272504.7957060832
9.671212897295495 99999.99999999959 384621.9041536204
I want to use gnuplot to do a log-log plot of the data using atomic units in the left y axys and using another units in the right y axys. Attemting to do so using the command:
p 'Freq_vs_Intensity_TDPT_AU.dat' u 1:2 w l, '' u 1:($2*3.51e16) w l axes x1y2
Produces two lines that are not superimposed as I want. How can I do this log-log plot?
should the rescaled column represent the same data expressed in different units, then there is probably no need to plot it twice. One could merely set the corresponding y2range and show the y2 axis, e.g.,
fac = 3.51e16
ymin = 1E-7
ymax = 1E5
set yr [ymin:ymax]
set y2r [ymin*fac:ymax*fac]
set ytics nomirror
set y2tics
p 'Freq_vs_Intensity_TDPT_AU.dat' u 1:2 w l
#, '' u 1:($2*3.51e16) w l axes x1y2

How to print input file next to graph in 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.

How to specify the start of the x-axis at 1 instead of 0

I use gnuplot to plot execution times measured on the CPU and GPU depending on the data size. So I have two files with the execution times in it. Plotting them is straight forward.
set title "CPU vs GPU"
set xlabel "Number of Particles (* 10'000)"
set ylabel "Time in Microseconds"
plot "cpuTimes.txt" title "CPU" with linespoints, \
"gpuTimes.txt" title "GPU" wit
The resulting plot can be found here: 1
I tried to use xtics however it doesn't shift the x-axis to start at 1 but just starts the ticks at 1. How can I shift the x-axis so it starts at 1 and ends at 50?
Update
Datafile cpuTimes.txt below
64780
129664
195490
266697
327871
391777
459150
517999
582959
647984
717377
790415
830869
900475
959599
1026041
1092899
1156022
1297471
1286325
1349227
1415936
1482857
1539580
1607389
1673436
1737098
1801568
1874431
1935975
2006892
2053077
2129867
2195117
2254467
2314478
2373546
2435416
2506850
2587302
2625556
2674799
2758387
2820720
2896794
2953550
3053817
3089501
3170513
3271537
xtics are only to "label" the x-axis. What you are looking for is some sort of "data manipulation". I'd suggest making use of using like so:
plot "cpuTimes.txt" u ($0+1):1 t "CPU" w lp, \
"gpuTimes.txt" u ($0+1):1 t "GPU" w lp
To make the plot end at 50 there are two ways:
You could specify the x-range with set xrange [1:50] or with
plot [1:50] "cpuTimes.txt" u ($0+1):1 t "CPU" w lp, \
"gpuTimes.txt" u ($0+1):1 t "GPU" w lp
You need to include every like so:
plot "cpuTimes.txt" u ($0+1):1 every 1::::50 t "CPU" w lp, \
"gpuTimes.txt" u ($0+1):1 every 1::::50 t "GPU" w lp
See every for documentation for further reference.
I haven't used gnuplot in awhile, but I believe you can use set xrange to adjust what is plotted.
In your case the command is:
set xrange [ 1 : 50 ]
Give an axis range in your plot command:
plot [1:50] "cpuTimes.txt"

Resources