Gnuplot用线条缺少对数图的一部分

时间:2014-07-21 13:26:01

标签: gnuplot

我正在从具有大量积分的文件中以对数比例绘制gnuplot。我的问题是当我绘制with line时,情节不完整。

这是我的代码

reset

set term postscript enhanced eps 
set key spacing 1.5
set key above

set xlabel "{/Times-Italic=20 t} ({/Times-Italic=18 s})"
set ylabel "Re({/Times-Italic=18 E}_{/Times-Roman=12 1}) ({/Times-Italic=18 V/m})" font "Helvetica,17"


set output "comparison_inside_fields.eps"

set logscale y
set yrange [50:1000]
set size 0.65
set tics front
set autoscale xfixmax
set mytics



plot "Analytic_EField_linear_PW1000.dat" u ($1):($2) w l lw 3.0 lc rgb "red" title "Analytic"

以及我获得的内容(我使用with line选项)

plot with lines

以下是我使用with linepoints选项时获得的内容:

plot with linespoints

可以看出幅度非常不同(图中某些部分缺失)

以下是我的数据文件的开头:

0.00015387392589011234  7.313652881922458e-12
2.312598638290707   0.00035701591836333934
4.625043402655524   -0.001744775840111212
6.937488167020341   0.002635593752205557
9.249932931385157   -0.0005215622055282669
11.562377695749973  -0.005613086825804345
13.87482246011479   0.01249366876936029
16.18726722447961   -0.012382736136564444
18.499711988844425  -0.0020181737335104115
20.81215675320924   0.028723649497696395
23.124601517574057  -0.05012094968419514
25.437046281938876  0.038279900094260896
27.749491046303692  0.023923801664976076
30.06193581066851   -0.11533038535431513
32.37438057503333   0.16669371034405378
34.68682533939814   -0.09321600129492857
36.99927010376296   -0.1309301034450249
39.31171486812778   0.40051988606433
41.62415963249259   -0.48535671872158176
43.93660439685741   0.16649070546475073
46.24904916122223   0.5399099316925524
48.561493925587044  -1.232168105867311
50.87393868995186   1.2459769261991653
53.18638345431668   -0.11507488762648499
55.498828218681496  -1.8552829850255983
57.81127298304631   3.382803401901361
60.12371774741113   -2.7986555270043447
62.43616251177595   -0.6389967211773293
64.74860727614076   5.51426989128634
67.06105204050559   -8.304151572784775
69.3734968048704    5.388664168148824
71.68594156923521   3.75015272844521
73.99838633360002   -14.425030919810949
76.31083109796484   18.212393265682785
78.62327586232965   -8.478667370008186
80.93572062669446   -12.97687540501132
83.24816539105929   33.51638426060921
85.56061015542411   -35.56824953090619
87.87305491978893   9.40856000753122
90.18549968415374   35.27647851639774
92.49794444851855   -69.50776258315734
94.81038921288336   61.449793623526645
97.12283397724819   -1.6228361635281918
99.43527874161302   -81.02379138412921
101.74772350597783  128.9581369765603
104.06016827034264  -92.7707466330017
106.37261303470746  -26.447757900812622
108.68505779907227  161.93270361144855
110.9975025634371   -214.12871819296564
113.30994732780192  119.45585783490898
115.62239209216673  89.96095194003675
117.93483685653155  -285.7317471589638
120.24728162089636  317.7663537996275
122.55972638526117  -124.01572996273325
124.872171149626    -202.11640061029723
127.18461591399083  448.6506280112767
129.49706067835564  -419.9827707670321
131.80950544272045  86.08309090803309
134.12195020708526  365.1915786239035
136.43439497145008  -629.624568119988
138.7468397358149   491.14602028042196
141.0592845001797   7.891481162706526
143.3717292645445   -562.4072699731051
145.68417402890935  791.4969236427878
147.99661879327417  -502.2763471626183
150.5035739030082   13.884099360903015
153.0105290127422   520.8204640350236
155.51748412247625  -881.6934104166681
158.02443923221028  908.1151661797728
160.5313943419443   -572.5583226647265
163.03834945167833  -1.2427115662199242
165.54530456141237  586.2398821968137
168.05225967114637  -946.6933427251788
170.55921478088038  938.0729020767044
173.06616989061442  -567.8419722277353
175.57312500034845  -9.640902609650418
178.08008011008246  560.9159762355566
180.58703521981647  -872.6863353200358
183.0939903295505   838.3060236797851
185.60094543928454  -494.83506520401687
188.10790054901855  -2.206038846512456
190.61485565875256  451.11570059550513
193.1218107684866   -688.7790873119674
195.62876587822063  651.0809467524094
198.13572098795464  -386.3497628157256
200.64267609768865  21.890958357977766
203.1496312074227   296.375460851056
205.65658631715672  -462.54031622084955
208.16354142689073  444.0157365822762
210.67049653662474  -280.42470433064506
213.17745164635878  54.92312049445108
215.6844067560928   145.0857414540448
218.19136186582682  -260.0381031729339
220.69831697556083  272.25384298060726
223.20527208529487  -201.1193629800157
225.7122271950289   86.50996817394736
228.2191823047629   29.68981343307864
230.72613741449692  -116.44291282351615
233.23309252423095  158.2202647751979
235.740047633965    -153.3501360605131
238.247002743699    109.85818386548479
240.753957853433    -41.78819702780295
243.26091296316704  -33.21612337993096
245.76786807290108  96.11319382526196
248.2748231826351   -129.7956812617419
250.7817782923691   123.71311098643045
253.28873340210313  -78.27276737663576
255.79568851183717  6.594221425661203
258.3026436215712   68.22942390379339
260.8095987313052   -120.32271885190342
263.3165538410392   130.38660901353677
265.8235089507732   -93.52859844406629
268.33046406050727  22.08708002237634
270.83741917024133  58.17031802124714
273.34437427997534  -117.37651258829126
275.85132938970935  132.93609071406925
278.35828449944336  -98.44856138404579
280.86523960917737  26.538840596469896
283.3721947189114   55.68421808566666
285.8791498286454   -116.89396521508495
288.38610493837945  133.58986731791944
290.8930600481135   -99.22680880493188
293.4000151578475   26.84482598622531
295.9069702675815   55.86408102174007
298.41392537731554  -117.17243317452015
300.92088048704954  133.52438503648304
303.42783559678355  -98.61761881665147
305.93479070651756  25.848928619270673
308.4417458162516   56.82553470468037
310.7825692575499   -126.75861911490784
313.1233926988482   120.38477777502422
315.46421614014645  -41.56760839817918
317.8050395814447   -62.227360042603934
320.145863022743    128.51881336840586
322.48668646404127  -117.42573970103275
324.8275099053395   35.66354870588547
327.16833334663784  67.51973624522823
345.8949208770241   77.65457486749145
348.2357443183224   -132.15621984538015
350.5765677596207   107.08262465337046
352.9173912009189   -17.570039114825722
355.25821464221724  -82.46788946432434
357.5990380835155   132.8124369061277
359.93986152481375  -103.18900629422026
362.28068496611206  11.472676841596469
364.6215084074103   87.0977415247355
383.34809593779653  95.77003989420436
385.68891937909484  -133.10234039723233
388.0297428203931   90.29942989194356
390.37056626169135  6.830770950764963
392.71138970298966  -99.79517783254691
395.052213144288    132.64082984131835
397.39303658558623  -85.63156461836667
399.7338600268845   -12.893048249605119
402.0746834681828   103.60220100679255
404.4155069094811   -131.90241290446895
406.75633035077936  80.79470446422403
409.0971537920776   18.914751141909303
411.43797723337593  -107.1836196221461
413.7788006746742   130.88925636595593
416.11962411597244  -75.79936284549744
418.46044755727075  -24.883352710313826
420.801270998569    110.5324343936077
423.14209443986726  -129.6040981573455
425.4829178811656   70.65636158786756
427.82374132246383  30.78646496260596
430.1645647637621   -113.64214797431963
432.5053882050604   128.05023901629258
434.84621164635865  -65.37680753556984
437.1870350876569   -36.611864463789345
439.5278585289552   116.5067784799463
441.86868197025353  -126.2315357764023
444.2095054115518   59.972069016868645
446.55032885285004  42.3475187199087
448.89115229414836  -119.12087218694946
451.23197573544667  124.15239225539777
453.5727991767449   -54.4537512236961
455.9136226180432   -47.98160997474198
458.2544460593415   121.47951162318009
460.54935183680567  -119.3558489246853
462.84425761426985  37.36915259082025
465.13916339173403  69.57726734548294
467.4340691691982   -129.90900102798213
469.7289749466624   103.28204052218221
472.02388072412657  -7.560904956403107
474.3187865015908   -93.16692160718839
476.613692279055    131.4990031452376
478.90859805651917  -81.820546703771
481.2035038339834   -22.57897781961767
483.4984096114476   111.8130287893108
485.79331538891176  -126.181029864139
488.08822116637594  56.11003837809997
490.3831269438401   51.467243113328195
492.6780327213043   -124.547395041013
494.9729384987685   114.24945319169423
497.26784427623267  -27.50978843225027
499.56275005369685  -77.58982748322487
501.8576558311611   130.71435145945915
504.15256160862526  -96.3452536061299
506.44746738608944  -2.472181851623384
508.7423731635537   99.58120227558055
511.03727894101786  -130.00449576667972
513.332184718482    73.42160505215651
515.6270904959463   32.2586088776568
517.9219962734104   -116.2957460135999
520.2169020508745   122.47017800182942
522.5118078283388   -46.693142944601085
524.806713605803    -60.2859544866391
527.1016193832671   126.86741429743867
529.3965251607312   -108.52195844988896
531.6914309381955   17.57161486760897
533.9863367156597   85.0864714462475
536.2812424931238   -130.75459974992916
538.576148270588    88.90626564395335
540.8710540480522   12.408676649154039
543.1659598255164   -105.36505868688015
545.4608656029806   127.76785852346595
547.7557713804447   -64.66546820307613
550.0506771579089   -41.671702751346714
552.3455829353732   120.06688302968028
554.6404887128373   -118.07908445609458
556.9353944903014   37.08249510517462
559.2303002677656   68.68255094803749
561.5252060452299   -128.4322375894202
563.820111822694    102.21169129425236
566.1150176001581   -7.6129464898599775
568.4099233776224   -92.02792746741741
570.7048291550866   130.03578430471495
572.9997349325507   -81.01235989772077
575.2946407100148   -22.191712442045123
577.5895464874791   110.49009660179456
579.8844522649433   -124.80815365701744
582.1793580424074   55.605873786165
584.4742638198716   50.765822734191346
586.7691695973358   -123.11039014662846
589.0640753748  113.03880586777576
591.3589811522642   -27.335451157521625
593.6538869297283   -76.61176960959067
595.9487927071925   129.2389754167297
598.2436984846568   -95.36004580833611
600.538604262121    -2.308261217612408
602.8335100395852   98.37846731727593
605.1284158170494   -128.56829867140056
607.6178319398828   92.12215116567913
610.107248062716    -18.360624948023567
612.5966641855495   -62.798559869391454
615.0860803083829   118.4572190784591
617.5754964312163   -126.07209761925677
620.0649125540497   82.58547885611515
622.5543286768831   -5.6528801737568894
625.0437447997165   -73.5250466645428
627.5331609225499   122.85618652507556
630.0225770453833   -122.3644115734156
632.5119931682167   72.27868702820577
635.0014092910501   7.071752162131414
637.4908254138835   -83.508792758487
639.9802415367169   126.0542695269919

1 个答案:

答案 0 :(得分:1)

某些点未连接,因为您的y值为负值,而对数值未定义。未定义的点会破坏情节线。使用using 1:($2 < 0 ? 1/0 : $2)进行过滤也是一样的,1/0的点也未定义。

您可以使用非常小的y值替换负值,该y值远远超出您的yrange:

set logscale y
set yrange [50:1000]
set mytics
set autoscale xfixmax

plot "Analytic_EField_linear_PW1000.dat" u 1:($2 <= 0 ? 1e-5 : $2) w l lw 3.0 title "Analytic"

enter image description here