为什么 Gnuplot 的点链接不好?

问题描述 投票:0回答:1

我无法放置所有数据,因为:看起来您的帖子主要是代码;请添加更多详细信息。

所以你可以在这里找到我的数据:https://gitlab.com/v_alexandre/data/-/blob/master/data

脚本:

plot 'data' u 1:2 w l

enter image description here

正如你所看到的,我有两点联系在一起,但我不明白为什么?

你有什么想法吗?

gnuplot
1个回答
0
投票

在数据的第 6 行之后插入一个空行。这将断开两个岛屿的连接。

脚本:

### disconnect lines
reset session

$Data <<EOD
9.2710321280228 41.364959299521
9.265698545799 41.362164776515
9.2558829669799 41.368794222327
9.2602446048541 41.373651229899
9.273659440522 41.369221791575
9.2710321280228 41.364959299521

8.5734085639674 42.381404942274
8.5869206603959 42.378959456159
8.6000271534091 42.369259196001
8.6100160917347 42.373593854505
8.620173521868 42.372270719131
8.6408019259839 42.37343904341
8.6504088344609 42.362352538519
8.6596703887356 42.359406967225
8.6819749384239 42.358462008729
8.6841460127953 42.347988396554
8.7110680867563 42.347099989534
# ... not all data shown...
EOD

plot $Data u 1:2 w l
### end of script

结果:

enter image description here

补充:

仅供记录,一些更多的解释和代码可能对其类似情况下的其他人有用。 您的数据似乎描述了封闭区域的点,例如一些岛屿的坐标。由于某些(不幸的)原因,您的各个岛屿没有被空线分隔,这就是 gnuplot 一次性绘制它的原因。 gnuplot 应该如何知道在哪里分隔? 必须告诉gnuplot在哪里产生不连续性。但怎么知道?

好吧,如果这些都是封闭区域,那么起点和终点应该是相同的。因此,您需要遍历数据,每次找到相同的数据点时,您都会在后面引入一个间隙(空行)。 当然,您不想手动执行此操作,例如如果您想到加拿大的岛屿或芬兰的湖泊。 当然,您可以使用外部工具执行此操作并将数据保存到另一个文件,但您也可以使用 gnuplot 执行此操作。然而,对于最终结果,仅“举笔”而不修改数据可能就足够了。使用 gnuplot,您可以发挥“技巧”并使该行透明,例如颜色

0xff123456
(根据方案
0xAARRGGBB
)无论哪种颜色只要以
0xff
开头即可,即完全透明。

总结:定义一个函数,每次特定坐标再次出现后将颜色设置为透明。也许有人甚至可以简化该功能。

数据:

SO65655925.dat

# x       y
-76.3499  18.1519
-76.7007  18.2572
-76.7933  18.3043
-76.9082  18.3904
-76.9594  18.4019
-77.0138  18.4029
-77.1396  18.4215
-77.2615  18.4574
-77.3542  18.4665
-77.4516  18.467
-77.8734  18.5222
-77.9269  18.5007
-77.9782  18.4678
-78.0945  18.4448
-78.2167  18.4481
-78.2524  18.4263
-78.326  18.3498
-78.3395  18.2872
-78.2941  18.2181
-78.0736  18.1912
-78.0445  18.1738
-77.963  18.0476
-77.8813  18.019
-77.8494  17.9875
-77.7682  17.8774
-77.6708  17.8597
-77.4639  17.8561
-77.3614  17.8337
-77.2799  17.7795
-77.205  17.7149
-77.1584  17.8451
-77.1195  17.8801
-77.0713  17.9013
-77.0359  17.8541
-76.9441  17.8488
-76.8962  17.9041
-76.8532  17.9737
-76.7948  17.9763
-76.7483  17.9649
-76.7743  17.9404
-76.6694  17.9276
-76.6254  17.901
-76.5246  17.8662
-76.4155  17.8682
-76.3015  17.8798
-76.2108  17.9135
-76.2328  17.9703
-76.3499  18.1519
-65.6288  18.3814
-65.7556  18.4016
-65.8788  18.4438
-66.0704  18.469
-66.0927  18.469
-66.0684  18.428
-66.0985  18.4252
-66.1294  18.4449
-66.1531  18.4707
-66.1886  18.4758
-66.8129  18.4925
-67.0596  18.5222
-67.113  18.5148
-67.1586  18.4992
-67.1718  18.4358
-67.2134  18.3936
-67.2641  18.3646
-67.239  18.3207
-67.2042  18.2834
-67.1725  18.2242
-67.1743  18.1525
-67.1969  17.9942
-67.1424  17.9667
-67.0133  17.9679
-66.9612  17.9538
-66.9  17.9479
-66.8376  17.9551
-66.7724  17.9866
-66.5984  17.9779
-66.5108  17.987
-66.4085  17.9506
-66.3258  17.9642
-66.2859  17.95
-66.245  17.9473
-66.1355  17.9495
-65.9708  17.9744
-65.8341  18.0573
-65.7822  18.1286
-65.7184  18.1867
-65.6208  18.2423
-65.6288  18.3814
-74.5131  20.3846
-74.6625  20.5221
-74.7321  20.5732
-74.8826  20.6506
-74.9597  20.6727
-75.2133  20.7139
-75.3381  20.7016
-75.5246  20.7167
-75.6428  20.7335
-75.7246  20.7146
-75.753  20.7362
-75.7604  20.7755
-75.7402  20.812
-75.5973  20.8376
-75.6629  20.8981
-75.6385  20.9475
-75.5958  20.9947
-75.6337  21.0613
-75.7229  21.111
-75.899  21.1143
-76.0736  21.1334
-76.2592  21.2274
-76.4552  21.2736
-76.5517  21.2721
-76.6474  21.2845
-76.6885  21.3404
-76.7261  21.3589
-76.765  21.3624
-76.8674  21.3304
-76.8598  21.3648
-76.8363  21.3995
-76.9281  21.459
-77.0986  21.589
-77.141  21.5386
-77.2079  21.4789
-77.2529  21.4835
-77.2696  21.5379
-77.3662  21.6126
-77.2445  21.5938
-77.1813  21.5977
-77.1441  21.6436
-77.2221  21.6724
-77.2995  21.7123
-77.3421  21.7553
-77.4973  21.8716
-77.5832  21.8893
-77.5733  21.8683
-77.5065  21.811
-77.4971  21.7883
-77.5451  21.7746
-77.6368  21.7974
-77.865  21.9006
-77.9705  21.972
-78.1431  22.1094
-78.6865  22.3668
-78.7192  22.3581
-78.776  22.3673
-78.8354  22.3909
-78.9019  22.396
-79.183  22.3879
-79.2757  22.4076
-79.3583  22.4489
-79.4565  22.5099
-79.5492  22.5778
-79.6767  22.7431
-79.8507  22.8272
-79.8203  22.887
-79.9235  22.8691
-79.9599  22.8769
-80.0752  22.9423
-80.1676  22.9494
-80.2662  22.935
-80.3649  22.9434
-80.4592  22.975
-80.5505  23.0166
-80.6134  23.0837
-80.6501  23.1031
-81.0077  23.0898
-81.1446  23.0549
-81.1786  23.0597
-81.2716  23.1286
-81.2624  23.1568
-81.3636  23.1297
-81.5754  23.1165
-81.8375  23.163
-82.1014  23.1904
-82.3505  23.154
-82.5878  23.0646
-82.6658  23.0436
-83.1772  22.983
-83.2578  22.9676
-84.0449  22.666
-84.1218  22.6186
-84.2813  22.4742
-84.3613  22.3789
-84.383  22.2556
-84.3264  22.0743
-84.3731  22.0359
-84.4331  22.0313
-84.4942  22.0416
-84.5328  22.0312
-84.8772  21.8941
-84.8872  21.857
-84.8382  21.8279
-84.7858  21.8423
-84.6827  21.8991
-84.6269  21.9204
-84.56  21.933
-84.5014  21.9303
-84.4909  21.8543
-84.5026  21.7762
-84.4488  21.7917
-84.2407  21.8983
-84.1383  21.929
-84.031  21.9431
-83.998  21.9801
-83.9633  22.0921
-83.9327  22.1497
-83.9007  22.1701
-83.6866  22.1799
-83.6431  22.189
-83.6015  22.2087
-83.544  22.2089
-83.4859  22.1871
-83.3796  22.223
-83.2921  22.3032
-83.1894  22.3554
-83.1437  22.3865
-83.1071  22.4299
-83.0094  22.514
-82.8612  22.5951
-82.7864  22.6583
-82.738  22.6893
-81.9034  22.679
-81.8388  22.6725
-81.7899  22.657
-81.7457  22.6329
-81.7027  22.5919
-81.6833  22.5348
-81.7104  22.4967
-81.7571  22.4667
-81.973  22.4218
-82.0777  22.3877
-81.9726  22.2909
-81.8494  22.2137
-81.8162  22.2002
-81.4411  22.1838
-81.3553  22.1041
-81.2844  22.1094
-81.2224  22.1429
-81.1996  22.2029
-81.1855  22.268
-81.1414  22.2069
-81.1167  22.1342
-81.0831  22.0979
-81.0356  22.0736
-80.9619  22.0529
-80.4991  22.0635
-80.4848  22.0872
-80.4854  22.1234
-80.3929  22.0337
-80.3107  21.9334
-80.2313  21.8722
-80.1383  21.8292
-79.9103  21.7426
-79.3574  21.5852
-79.2744  21.5626
-79.1892  21.5528
-78.8229  21.6189
-78.7277  21.5927
-78.6365  21.5155
-78.5766  21.4138
-78.5373  21.2968
-78.4908  21.0537
-78.4539  21.011
-78.4063  20.9739
-78.3139  20.9275
-78.1164  20.7619
-77.9973  20.7154
-77.8569  20.7136
-77.5927  20.6901
-77.467  20.6895
-77.3476  20.6724
-77.2296  20.6438
-77.2055  20.6108
-77.189  20.56
-77.1079  20.4917
-77.093  20.4529
-77.1038  20.4075
-77.1494  20.3473
-77.2134  20.3004
-77.5538  20.0821
-77.7151  19.8555
-77.4632  19.8614
-77.212  19.8938
-76.9995  19.8928
-76.8902  19.9213
-76.7797  19.9402
-76.5156  19.9567
-76.2528  19.9872
-76.1584  19.9897
-75.7651  19.9604
-75.6572  19.9322
-75.552  19.8911
-75.2905  19.8931
-75.2194  19.9236
-75.1773  19.9594
-75.1516  20.0083
-75.122  19.9539
-75.1241  19.9247
-75.1164  19.9014
-75.0032  19.9286
-74.9551  19.9579
-74.85  20.0023
-74.6348  20.0582
-74.4122  20.0753
-74.2528  20.0797
-74.2174  20.1171
-74.1537  20.1686
-74.1368  20.2319
-74.1675  20.2922
-74.1985  20.3115
-74.2339  20.3264
-74.2728  20.3174
-74.3844  20.3305
-74.5131  20.3846
-68.6848  18.9048
-68.9014  18.9885
-69.0313  19.0132
-69.163  19.0285
-69.2802  19.0519
-69.3953  19.0861
-69.5083  19.1076
-69.6236  19.1178
-69.6232  19.1605
-69.606  19.2065
-69.5197  19.212
-69.3228  19.2011
-69.2643  19.2257
-69.2325  19.2718
-69.325  19.3277
-69.7394  19.2992
-69.8234  19.3671
-69.8783  19.4733
-69.8912  19.5897
-69.9568  19.6719
-70.0141  19.6729
-70.1294  19.6361
-70.1938  19.638
-70.3047  19.6761
-70.4364  19.7712
-70.4793  19.777
-70.6362  19.7756
-70.6859  19.7933
-70.7853  19.8509
-70.8339  19.8873
-70.9542  19.914
-71.0819  19.8905
-71.2359  19.8481
-71.2813  19.8474
-71.4417  19.894
-71.5578  19.8954
-71.616  19.8774
-71.6674  19.8486
-71.7061  19.7952
-71.7351  19.7351
-71.7792  19.7182
-71.8347  19.6967
-71.9543  19.7217
-72.2198  19.7446
-72.4299  19.8133
-72.637  19.9009
-72.8765  19.9281
-73.1178  19.9038
-73.2178  19.8837
-73.3153  19.8546
-73.4005  19.8074
-73.4384  19.7221
-73.3963  19.6587
-73.3155  19.6373
-73.0527  19.6107
-72.8634  19.5261
-72.7032  19.4411
-72.7418  19.3418
-72.768  19.2406
-72.7412  19.1313
-72.8111  19.0716
-72.6491  18.8941
-72.4652  18.7436
-72.3477  18.675
-72.3467  18.6237
-72.3761  18.5745
-72.4181  18.5587
-72.6181  18.5508
-72.6598  18.5153
-72.696  18.4682
-72.7395  18.4421
-72.7894  18.4348
-72.9173  18.4557
-73.5916  18.5224
-73.687  18.5653
-73.8625  18.5754
-73.976  18.6014
-74.1003  18.6411
-74.2277  18.6627
-74.2845  18.6567
-74.3875  18.6247
-74.4781  18.45
-74.46  18.3931
-74.419  18.3462
-74.1946  18.2692
-74.0854  18.2151
-73.9895  18.1432
-73.885  18.0419
-73.8392  18.0582
-73.8247  18.1218
-73.7473  18.1902
-73.644  18.2291
-73.5148  18.2454
-73.3852  18.2512
-73.2723  18.2335
-73.1601  18.2056
-72.8767  18.1518
-72.7553  18.1562
-72.6333  18.1762
-72.5919  18.1869
-72.5532  18.2084
-72.5036  18.2199
-72.0599  18.2286
-72.0021  18.212
-71.9461  18.1861
-71.8529  18.1191
-71.7683  18.0392
-71.7125  18.0055
-71.6737  17.9541
-71.6572  17.8887
-71.6583  17.8211
-71.6317  17.7736
-71.569  17.7574
-71.5184  17.725
-71.439  17.6356
-71.3957  17.6461
-71.3583  17.6941
-71.2673  17.8496
-71.106  18.07
-71.0826  18.1284
-71.0822  18.2244
-71.07  18.2503
-71.0278  18.2732
-70.9243  18.2925
-70.7588  18.3456
-70.6447  18.3362
-70.5654  18.2676
-70.4799  18.2173
-70.1831  18.2518
-70.1416  18.2771
-70.0633  18.3457
-70.0183  18.3736
-69.8964  18.4177
-69.7707  18.4436
-69.6447  18.4364
-69.5194  18.4157
-69.397  18.4201
-69.2745  18.4398
-69.0723  18.3992
-68.935  18.408
-68.8195  18.3393
-68.7785  18.2661
-68.721  18.2184
-68.6874  18.2149
-68.6588  18.222
-68.6122  18.3062
-68.5638  18.3555
-68.4932  18.379
-68.4448  18.4177
-68.3593  18.5381
-68.3392  18.6115
-68.3814  18.6711
-68.4454  18.7145
-68.6848  18.9048
-64.845  18.3301
-64.8891  18.3742
-64.942  18.3852
-65.0236  18.3676
-64.92  18.3213
-64.845  18.3301
-73.1706  18.9673
-73.2764  18.9541
-73.2853  18.8967
-73.078  18.7909
-72.8222  18.7071
-72.8046  18.7777
-72.9192  18.8615
-73.0691  18.932
-73.1706  18.9673
-63.115  18.0907
-63.1247  18.0643
-63.0904  18.0414
-63.023  18.0192
-63.0123  18.0454
-63.0094  18.1043
-63.0248  18.1131
-63.0631  18.1153
-63.115  18.0907
-65.5722  18.1373
-65.5551  18.1077
-65.504  18.0995
-65.4256  18.1056
-65.2949  18.1333
-65.3027  18.1444
-65.3662  18.1611
-65.4771  18.165
-65.5722  18.1373
-62.6249  17.1296
-62.5824  17.1006
-62.5322  17.1219
-62.5342  17.1701
-62.5747  17.201
-62.6153  17.1991
-62.6249  17.1296
-64.4261  18.5131
-64.4437  18.4734
-64.438  18.459
-64.4211  18.4574
-64.3952  18.4646
-64.3247  18.5175
-64.4261  18.5131
-64.7877  18.3411
-64.7706  18.3316
-64.726  18.3279
-64.6598  18.3543
-64.7524  18.372
-64.7877  18.3411
-64.651  18.4425
-64.6951  18.4117
-64.6718  18.3991
-64.5937  18.4028
-64.5452  18.4381
-64.5691  18.4463
-64.651  18.4425
-64.8891  17.7017
-64.6863  17.7061
-64.5805  17.7502
-64.6818  17.7502
-64.7656  17.7943
-64.8847  17.7723
-64.8891  17.7017
-77.7744  22.083
-77.8547  22.0919
-77.9186  22.0881
-77.9  22.0372
-77.8232  21.9879
-77.7836  21.9704
-77.755  21.9656
-77.7101  21.9213
-77.669  21.952
-77.646  21.9965
-77.6337  22.054
-77.7744  22.083
-78.0271  22.2852
-78.0617  22.3059
-78.0941  22.3872
-78.1506  22.4315
-78.201  22.4376
-78.2735  22.4236
-78.27  22.4022
-78.2261  22.38
-78.18  22.322
-78.1017  22.3058
-78.0475  22.2685
-78.0271  22.2852
-78.2839  22.4555
-78.3512  22.5386
-78.3996  22.5475
-78.4453  22.5437
-78.4929  22.5311
-78.6301  22.5522
-78.6955  22.534
-78.6736  22.5088
-78.629  22.4882
-78.5477  22.464
-78.4246  22.4601
-78.3899  22.4451
-78.343  22.4451
-78.2839  22.4555
-74.2422  22.7151
-74.0986  22.6654
-74.0348  22.7056
-74.0575  22.7235
-74.1754  22.7599
-74.2215  22.8116
-74.307  22.8396
-74.314  22.8036
-74.3031  22.7645
-74.2746  22.7117
-74.2422  22.7151
-73.661  20.9374
-73.4008  20.9439
-73.1646  20.9792
-73.0587  21.119
-73.0269  21.1924
-73.0117  21.2995
-73.0585  21.3134
-73.1373  21.2048
-73.2354  21.1545
-73.3016  21.1562
-73.4245  21.2018
-73.5231  21.1908
-73.5851  21.1259
-73.6804  21.1033
-73.6696  21.0822
-73.6678  21.0616
-73.6868  21.0091
-73.6812  20.9756
-73.661  20.9374
-73.9146  22.568
-73.9064  22.5274
-73.936  22.4777
-73.995  22.4492
-74.0101  22.428
-74.0523  22.4006
-74.1268  22.3234
-74.2613  22.2355
-74.2769  22.1837
-74.2067  22.2138
-74.0929  22.3062
-73.9746  22.3612
-73.8365  22.5384
-73.8775  22.6808
-73.85  22.7311
-73.9542  22.7155
-73.9755  22.6823
-73.9764  22.6351
-73.9146  22.568
-75.9486  23.6474
-76.0104  23.6714
-76.0371  23.6028
-75.956  23.5923
-75.781  23.4707
-75.7063  23.4442
-75.6646  23.4501
-75.7542  23.49
-75.8075  23.5425
-75.9486  23.6474
-75.1306  23.2679
-75.1411  23.2046
-75.2044  23.1927
-75.2233  23.1653
-75.1321  23.1171
-74.9733  23.0686
-74.8469  22.8687
-74.8405  22.8943
-74.8456  22.9999
-74.9371  23.0881
-75.0642  23.1502
-75.1088  23.3328
-75.1753  23.4387
-75.2166  23.5468
-75.316  23.6684
-75.3098  23.5898
-75.2882  23.5683
-75.2413  23.4746
-75.1576  23.3364
-75.1306  23.2679
-77.8794  22.1275
-77.8425  22.149
-77.8891  22.2011
-77.8937  22.2146
-77.9696  22.2407
-77.9856  22.3021
-77.9992  22.2987
-78.0067  22.248
-78.0417  22.2013
-78.0119  22.1664
-77.9124  22.1247
-77.8794  22.1275
-82.6818  21.8211
-82.7146  21.8903
-82.7558  21.9095
-82.9912  21.9427
-83.0777  21.8335
-83.0825  21.7914
-82.9736  21.5923
-83.0072  21.5656
-83.0549  21.5494
-83.1129  21.5737
-83.1802  21.623
-83.1838  21.5935
-83.1415  21.5319
-83.0673  21.4694
-82.9596  21.4413
-82.8532  21.4439
-82.6548  21.5187
-82.5618  21.5717
-82.5678  21.6218
-82.6294  21.7669
-82.6818  21.8211
-79.3822  22.6813
-79.5792  22.8067
-79.6282  22.8052
-79.5979  22.7876
-79.5228  22.7111
-79.3479  22.6377
-79.3496  22.6639
-79.3822  22.6813
-81.2848  19.3625
-81.2965  19.3414
-81.3373  19.3295
-81.3695  19.3489
-81.391  19.3849
-81.4191  19.3748
-81.4048  19.2784
-81.3037  19.2719
-81.2773  19.2774
-81.2246  19.3041
-81.1071  19.3052
-81.1305  19.3468
-81.2848  19.3625
-62.7137  17.3533
-62.7946  17.4026
-62.8271  17.3864
-62.8394  17.3653
-62.8405  17.3471
-62.8389  17.3393
-62.7755  17.3028
-62.702  17.286
-62.6565  17.2244
-62.6307  17.24
-62.6405  17.2623
-62.6758  17.2909
-62.7137  17.3533
-60.9337  14.6862
-60.9187  14.7354
-60.9271  14.7552
-60.9525  14.7562
-61.0271  14.8262
-61.1274  14.8753
-61.1808  14.8719
-61.2133  14.8486
-61.2197  14.8044
-61.1411  14.6524
-61.1043  14.6212
-61.0113  14.6019
-61.0903  14.5297
-61.0889  14.5096
-61.0637  14.4671
-60.8994  14.4738
-60.8621  14.4263
-60.8366  14.4374
-60.8263  14.4945
-60.87  14.6137
-60.8892  14.6445
-60.9337  14.6862
-62.1758  16.8096
-62.1914  16.8044
-62.223  16.7516
-62.2216  16.6995
-62.1542  16.6812
-62.1484  16.7403
-62.1758  16.8096
-63.16  18.1714
-63.0012  18.2218
-62.9796  18.2648
-63.026  18.2697
-63.1533  18.2003
-63.16  18.1714
-61.762  17.5487
-61.7471  17.575
-61.7496  17.6613
-61.7768  17.6905
-61.8199  17.6969
-61.8524  17.7141
-61.8662  17.7043
-61.8687  17.6854
-61.8438  17.5961
-61.762  17.5487
-61.25  16.0063
-61.2753  15.9962
-61.3184  15.9549
-61.3107  15.8947
-61.2862  15.886
-61.2305  15.8899
-61.2034  15.9212
-61.2124  15.9599
-61.25  16.0063
-61.8597  17.0133
-61.7481  16.9972
-61.7161  17.037
-61.695  17.0489
-61.6865  17.0698
-61.686  17.0984
-61.7082  17.1051
-61.7386  17.1385
-61.8173  17.1689
-61.8871  17.0981
-61.882  17.0631
-61.8597  17.0133
-61.2511  15.3731
-61.2772  15.5267
-61.32  15.5851
-61.4581  15.6331
-61.4699  15.6035
-61.4812  15.5251
-61.4157  15.3999
-61.3754  15.2273
-61.2817  15.249
-61.2511  15.3731
-61.1726  16.2561
-61.3555  16.3632
-61.3961  16.4134
-61.4064  16.4683
-61.4712  16.5066
-61.5106  16.4777
-61.5289  16.4338
-61.5006  16.3602
-61.54  16.2996
-61.5222  16.228
-61.4448  16.2193
-61.3271  16.2304
-61.1726  16.2561
-61.6415  16.326
-61.748  16.3553
-61.7671  16.3405
-61.7941  16.301
-61.7594  16.0621
-61.7103  15.9759
-61.6705  15.9621
-61.5896  16.0069
-61.5639  16.0478
-61.575  16.2271
-61.5523  16.2709
-61.597  16.2922
-61.6415  16.326
-72.9811  22.3692
-72.8892  22.3603
-72.7839  22.2906
-72.7473  22.3274
-72.7626  22.3444
-72.8308  22.3856
-72.9452  22.4156
-72.979  22.4146
-73.041  22.4291
-73.1274  22.4553
-73.1619  22.3807
-73.1102  22.3676
-72.9811  22.3692
-71.7218  21.7902
-71.6654  21.7517
-71.6614  21.7652
-71.6369  21.7875
-71.6684  21.8334
-71.8062  21.8521
-71.8477  21.8435
-71.8304  21.7906
-71.7218  21.7902
-72.9161  21.5067
-72.9948  21.5616
-73.0627  21.5153
-73.0493  21.4576
-72.9161  21.5067
-71.9555  21.8644
-71.8975  21.8299
-71.8799  21.8404
-71.8996  21.8625
-71.9315  21.9519
-72.0106  21.9504
-72.019  21.9183
-71.9845  21.8934
-71.9638  21.892
-71.9555  21.8644
-72.1907  21.7698
-72.1815  21.78
-72.1443  21.7927
-72.1498  21.8045
-72.2187  21.7963
-72.3328  21.8514
-72.3424  21.7953
-72.3354  21.758
-72.3009  21.7552
-72.1907  21.7698
-72.8515  20.0937
-72.9067  20.0858
-72.9604  20.0623
-72.8993  20.0314
-72.8784  20.0274
-72.8442  20.0354
-72.7398  20.0034
-72.6389  19.9858
-72.6235  20.0142
-72.6641  20.0375
-72.791  20.0919
-72.8515  20.0937

脚本:(适用于 gnuplot>=5.0.0,2015 年 1 月)

### autoseparation of data describing closed areas 
reset session

FILE = "SO65655925.dat"

# function to set color to transparent when coordinate appears again
myColor(colX,colY,color) = \
    ($0==0 ? (x2=y2=NaN, c=0, x0=column(colX), y0=column(colY)) : 0, \
     x1=x2, x2=column(colX), y1=y2, y2=column(colY), \
     x1==x0 && y1==y0 ? c=c+1 : 0, c==2 ? (c=0,x0=x2,y0=y2) : 0, \
     c==0 && $0!=0 ? 0xff123456 : color )

set multiplot layout 2,1
    plot FILE u 1:2 w l lc "black" ti "Data as is"

    plot FILE u 1:2:(myColor(1,2,0xff0000)) w l lc rgb var ti 'Data with "autoseparation"'
unset multiplot
### end of script

结果:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.