matplotlib 在pandas中以对数标度绘制x轴和y轴

p5cysglq  于 2023-04-06  发布在  其他
关注(0)|答案(3)|浏览(146)

当我在对数尺度中只绘制y轴时,一切都很好。

import pandas as pd
import numpy
import matplotlib.pyplot as plt

iplevel = pd.read_csv('iplevel.csv')
fig = plt.figure()
#plt.xscale('log')
plt.yscale('log')
plt.title(' Size Vs Duration (at IP level) for ')

plt.xlabel('Duration (in seconds)')
plt.ylabel('Size (in bytes)')
plt.scatter(iplevel['Time'], iplevel['Length'])
fig.tight_layout()
fig.savefig('iplevel_timevdur.png', dpi=fig.dpi)

当我把x轴和y轴都用对数标度绘制时,会发生一些奇怪的事情。

iplevel = pd.read_csv('iplevel.csv')
fig = plt.figure()
plt.xscale('log')
plt.yscale('log')
plt.title(' Size Vs Duration (at IP level) for ')

plt.xlabel('Duration (in seconds)')
plt.ylabel('Size (in bytes)')
plt.scatter(iplevel['Time'], iplevel['Length'])
fig.tight_layout()
fig.savefig('iplevel_timevdur.png', dpi=fig.dpi)

我不知道我错在哪里。欢迎任何想法/建议
我的跟踪文件可以从here下载。下面是按'Time'排序的2715行中的前1800行。

Length,Time
64,0.0
64,0.0
64,0.0
863,0.0
259,0.0
64,0.0
64,0.0
78,0.0
64,0.0
64,0.0
64,0.0
86,0.0
64,0.0
102,0.0
64,0.0
140,0.0
90,0.0
140,0.0
152,0.0
260,0.0
64,0.0
1419,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
140,0.0
64,0.0
140,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
634,0.0
64,0.0
64,0.0
64,0.0
64,0.0
78,0.0
64,0.0
1241,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
66,0.0
64,0.0
64,0.0
64,0.0
66,0.0
66,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
78,0.0
66,0.0
66,0.0
66,0.0
64,0.0
66,0.0
66,0.0
64,0.0
64,0.0
64,0.0
140,0.0
140,0.0
140,0.0
66,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
70,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
64,0.0
70,0.0
64,0.0
64,0.0
64,0.0
70,0.0
64,0.0
82,0.0
70,0.0
122,0.0
70,0.0
174,0.0
64,0.0
911,0.0
64,0.0
64,0.0
64,0.0
128,0.0
129,0.0
64,0.0
64,0.0
140,0.0
140,0.0
64,0.0
94,0.0
1518,0.0
64,0.0
64,0.0
68,0.0
127,0.0
70,0.0
86,0.0
66,0.0
66,0.0
64,0.0
66,0.0
66,0.0
66,0.0
64,0.0
70,0.0
86,0.0
64,0.0
66,0.0
64,0.0
64,0.0
64,0.0
64,0.0
140,0.0
1045,0.0
64,0.0
70,0.0
64,0.0
64,0.0
70,0.0
64,0.0
140,0.0
66,0.0
70,0.0
140,0.0
64,0.0
64,0.0
171,0.0
128,4.00000000411e-06
128,4.99999999803e-06
128,8.00000000112e-06
128,2.29999999988e-05
448,3.00000000002e-05
140,4.40000000026e-05
256,7.19999999959e-05
384,0.000106999999986
320,0.000121000000007
384,0.000253999999984
128,0.000342
204,0.000381000000004
140,0.000453
204,0.000878999999998
358,0.001082
448,0.001192
315,0.00134000000003
448,0.00136600000002
280,0.001679
128,0.001698
635,0.001723
324,0.00185
174,0.00224799999998
128,0.002389
128,0.002625
128,0.002629
128,0.00279799999999
635,0.00283899999997
635,0.002866
2917,0.00290999999999
128,0.002927
761,0.00293099999999
198,0.00299800000001
128,0.003002
198,0.003066
128,0.00318299999998
128,0.003261
391,0.00328500000001
128,0.003311
128,0.003378
1372,0.00350099999997
128,0.003875
634,0.00393600000001
128,0.00412900000001
128,0.00423000000001
642,0.00425000000001
128,0.00425200000001
128,0.00436499999995
128,0.00437899999999
128,0.00458800000001
128,0.00463000000002
128,0.00491100000001
128,0.00500199999999
724,0.005042
856,0.00510100000002
128,0.00520300000005
128,0.005244
146,0.00525199999999
128,0.005268
128,0.0054
128,0.005458
128,0.005505
128,0.005516
213,0.00555099999997
146,0.00557399999997
1128,0.00558500000001
128,0.00563299999999
128,0.0057
128,0.00574699999999
1454,0.00586200000001
2202,0.00588400000001
128,0.00593999999995
128,0.00594099999995
128,0.00600400000002
128,0.00604500000003
128,0.00613000000001
1638,0.00623899999999
128,0.00624499999998
128,0.00663800000001
420,0.006648
128,0.00665499999999
2917,0.00671500000001
889,0.00673999999998
128,0.00673999999998
128,0.00719199999997
213,0.007203
146,0.00725600000004
128,0.00731100000002
128,0.00731200000001
128,0.00744800000001
128,0.00780899999995
128,0.008038
128,0.00837999999999
128,0.00841500000001
128,0.008512
128,0.00854400000009
128,0.00867199999999
128,0.00873899999999
194,0.00874200000001
128,0.00896799999998
128,0.00931600000001
128,0.00939499999993
128,0.00957499999998
128,0.00968400000002
128,0.00969899999998
128,0.00976299999999
128,0.00981899999999
146,0.00988299999997
128,0.010383
128,0.010574
128,0.010702
128,0.011247
256,0.011263
128,0.0114830000001
128,0.011669
128,0.012947
128,0.013
128,0.013004
128,0.013068
128,0.013546
128,0.013569
134,0.013771
128,0.013863
128,0.013904
128,0.013956
128,0.014034
488,0.014187
128,0.014252
768,0.014261
128,0.014387
128,0.014798
128,0.015014
128,0.015765
128,0.015956
637,0.01609
128,0.016199
128,0.016338
128,0.018201
128,0.018332
340,0.019342
174,0.019462
128,0.019505
128,0.020325
248,0.020937
128,0.021647
2291,0.021786
1685,0.021814
128,0.022295
637,0.022531
128,0.024646
555,0.025917
194,0.029173
637,0.030238
1096,0.033326
1186,0.033387
1416,0.039525
1282,0.04019
37292,0.042872
1920,0.050076
198,0.05401
2613,0.0541250000001
5408,0.058094
194,0.062085
1163,0.063978
4145,0.064394
401,0.065523
256,0.069589
194,0.071795
174,0.073762
1835,0.07433
1763,0.074372
5808,0.07657
1198,0.078694
192,0.079372
740,0.079504
1017,0.083836
357,0.084731
1311,0.084966
646,0.085513
382,0.085933
355,0.089751
356,0.092304
354,0.095439
375,0.095455
64438,0.097073
356,0.098272
1085,0.104543
1707,0.106295
128,0.107193
128,0.116315
128,0.11694
256,0.117687
194,0.120159
128,0.121077
274,0.12117
128,0.121954
128,0.121982
128,0.122509
128,0.123191
128,0.123441
421,0.124742
128,0.127664
128,0.128375
128,0.129587
128,0.129691
12298,0.129699
151,0.129914
716,0.130497
128,0.131315
128,0.132431
128,0.132454
128,0.132505
143,0.133811
128,0.133967
502,0.136675
401,0.137227
128,0.137713
128,0.138319
158,0.140466
158,0.140539
772,0.142128
128,0.142269
128,0.143148
128,0.143635
635,0.144937
158,0.145076
1895,0.146925
2319,0.147019
128,0.147344
128,0.1482
128,0.149632
128,0.150156
392,0.150575
128,0.153975
128,0.155053
128,0.155361
491,0.155367
1036,0.155489
815,0.155604
256,0.155636
158,0.155997
391,0.156097
128,0.156179
128,0.15667
128,0.157108
194,0.158414
487,0.158753
24731,0.159841
128,0.15987
2080,0.160029
128,0.160672
128,0.161457
128,0.163697
129,0.164798
128,0.165359
692,0.165807
176,0.167277
169,0.168042
128,0.168774
128,0.169179
196,0.172226
827,0.172598
644,0.174389
5952,0.174891
929,0.174913
293,0.176155
128,0.177965
143,0.178284
128,0.178395
128,0.178532
128,0.178967
128,0.179142
1234,0.180979
2687,0.180993
132,0.181699
128,0.182471
575,0.182731
1056,0.182738
128,0.185525
128,0.185713
583,0.185903
128,0.18656
579,0.186636
128,0.187764
128,0.188738
565,0.191839
128,0.193028
201,0.193634
128,0.193767
128,0.194193
128,0.194831
128,0.194946
189,0.194996
128,0.19509
128,0.195895
128,0.196691
302,0.196983
151,0.197677
128,0.198477
128,0.198502
128,0.199194
158,0.199917
128,0.200496
187,0.202062
128,0.205278
151,0.205333
128,0.205422
580,0.20576
128,0.206018
128,0.207292
128,0.208323
128,0.210094
188,0.210111
132,0.215272
128,0.216109
192,0.216621
158,0.218086
132,0.21816
5295,0.219534
913,0.219622
342,0.221066
158,0.224464
128,0.225023
158,0.226123
463,0.228006
493,0.231975
706,0.232099
158,0.232812
128,0.233406
2696,0.23379
128,0.233908
634,0.235822
129,0.23812
129,0.23883
329,0.239234
638,0.242231
445,0.243746
158,0.244659
1663,0.246321
158,0.249088
747,0.249402
158,0.2499
21044,0.250114
198,0.25574
348,0.258529
128,0.260478
4082,0.261739
2284,0.262233
192,0.262749
128,0.263667
306,0.264054
128,0.26577
1373,0.270913
1888,0.271282
1274,0.275812
12018,0.275892
10476,0.276982
583,0.277477
216,0.282457
14545,0.284088
192,0.286135
128,0.286502
192,0.288131
192,0.290647
128,0.291587
192,0.291958
192,0.292444
192,0.292899
192,0.29314
192,0.29407
192,0.29408
192,0.294389
128,0.295584
192,0.295769
192,0.296455
192,0.296522
192,0.297143
128,0.299582
192,0.300152
128,0.303719
10901,0.304753
158,0.311613
15294,0.311968
169,0.318904
16637,0.323573
128,0.323853
1131,0.326026
5624,0.32706
858,0.327223
193160,0.327704
5027,0.328746
16486,0.328849
16519,0.33159
16614,0.332795
16499,0.334356
13759,0.337339
17856,0.338391
16494,0.338654
17719,0.34317
9415,0.343345
930,0.346175
381,0.34628
16303,0.348078
15178,0.348412
775,0.348559
19238,0.350086
18700,0.353331
256,0.359896
382,0.359918
2558,0.360789
46880,0.361324
15910,0.365415
1264,0.365972
679,0.366998
15467,0.368123
5525,0.369106
12990,0.371463
17966,0.372187
17663,0.372509
134,0.375373
719,0.375583
17571,0.375708
1364,0.379144
1879,0.379576
2607,0.381864
1703,0.388304
17350,0.388741
13914,0.389419
660,0.394224
2618,0.405323
59357,0.405666
843,0.40665
26746,0.407601
3840,0.409754
4956,0.410115
1368,0.412279
815,0.413427
892,0.416514
839,0.418113
17118,0.418644
827,0.419991
810,0.421766
877,0.422231
901,0.422979
1276,0.426812
17086,0.427301
17470,0.428345
18848,0.432816
1013,0.433402
15324,0.44241
1187,0.442809
651,0.442949
1674,0.443054
725,0.445347
984,0.446618
19421,0.447274
812,0.447613
20072,0.448172
198,0.453756
846,0.454722
823,0.455468
3000,0.458553
74223,0.45879
811,0.464353
17925,0.465033
957,0.466624
903,0.46717
853,0.471707
883,0.474617
15265,0.475074
2859,0.479295
69231,0.479809
22274,0.482061
1430,0.482937
1152,0.483017
192,0.495713
1256,0.496494
262,0.512057
945,0.514055
882,0.516906
813,0.521878
1190,0.526782
16500,0.531624
1392,0.531651
1146,0.533169
11746,0.534001
731,0.547279
69763,0.562352
2269,0.562531
814,0.567499
1155,0.567765
15278,0.568393
2280,0.571201
8595,0.571894
649,0.577326
27680,0.580275
45720,0.580645
925,0.587776
610,0.587808
13084,0.58785
811,0.591747
15561,0.610443
805,0.612655
1393,0.612754
8595,0.614398
16450,0.615835
747,0.616062
632,0.617268
130,0.617361
128,0.619322
709,0.624645
18616,0.625252
128,0.626572
22915,0.630266
1471,0.630274
3278,0.632551
2644,0.633244
14472,0.638248
1007,0.645869
927,0.648553
612,0.64867
742,0.652169
1869,0.65374
944,0.654074
629,0.654108
11976,0.657089
944,0.66175
923,0.662101
608,0.66242
923,0.662682
608,0.662912
629,0.663036
1199,0.663707
1392,0.665542
942,0.670232
627,0.670315
3276,0.672378
16473,0.68492
15610,0.687139
981,0.690428
966,0.696134
742,0.696406
15377,0.696902
15390,0.697062
4036,0.698605
14278,0.698683
2145,0.699245
973,0.700019
979,0.707477
900,0.720126
1014,0.72825
1338,0.728329
21603,0.734982
4417,0.73812
29601,0.738155
815,0.739386
15692,0.752112
904,0.767532
16403,0.769054
9863,0.77061
256,0.7783
908,0.778677
876,0.78051
1039,0.783406
906,0.785664
80790,0.798551
8024,0.81017
1144,0.810329
1071,0.820726
5029,0.82554
9165,0.829863
1747,0.829993
24116,0.836781
910,0.839971
14206,0.844666
256,0.860852
939,0.863164
21119,0.878541
12890,0.895014
145219,0.898687
1126,0.904611
262,0.906134
2287,0.918069
39641,0.919033
1161,0.920171
819,0.928013
766,0.957101
89878,0.958262
2229,0.990084
3440,0.997017
192,1.002555
1455,1.005322
198,1.006339
129423,1.020995
93375,1.036018
177021,1.042311
3976,1.04486
1485,1.04614
116872,1.056224
2031,1.068529
14510,1.072201
143841,1.099723
1391,1.113283
2606,1.116592
2594,1.12213
198,1.124238
192,1.124257
2478,1.132794
4272,1.137188
198,1.144263
192,1.144285
3183,1.14648
121979,1.170081
2168,1.179906
4143,1.196728
228562,1.199929
316231,1.206644
1323,1.237462
229051,1.249463
19961,1.258074
1946,1.258145
3375,1.259435
15663,1.28884
1575,1.288916
7408,1.288983
530,1.322116
627,1.322308
16002,1.323453
529,1.327567
626,1.327778
53706,1.347712
160416,1.361633
149,1.37606
412,1.381473
6267,1.406762
1014,1.407138
5616,1.423929
2990,1.445728
1927,1.451354
534,1.472753
647,1.47312
861,1.498473
4334,1.513561
1298,1.538317
150,1.568103
1553,1.585452
71503,1.590587
1852,1.618126
723,1.618197
121256,1.622943
16237,1.622989
4602,1.624606
6117,1.627509
535,1.633484
1241,1.671162
994,1.673655
693,1.676804
12577,1.67702
1103,1.702646
396,1.732566
31302,1.778889
3096,1.779305
5547,1.805192
536,1.81023
634,1.810236
537,1.840026
16989,1.870537
24671,1.885863
5787,1.907246
4702,1.920082
10970,1.928192
785,1.928722
14565,1.93629
18750,1.945438
2355,1.94557
1756,1.947581
2671,1.969702
8263,1.994232
501,1.995956
851,1.996988
3033,2.029218
454182,2.036176
827,2.069595
1888,2.070088
2892,2.104399
2300,2.108769
2681,2.108788
877,2.114206
12283,2.121828
1632,2.122034
11827,2.147509
1506,2.186309
969740,2.188838
12461,2.189016
2248,2.20968
371473,2.210276
8181,2.225332
786,2.225418
2248,2.232343
23839,2.241228
11621,2.242529
1111,2.242709
2184,2.292833
63730,2.299825
2893,2.301329
20601,2.301606
2124,2.301609
281,2.311735
8304,2.314339
11800,2.370985
1728,2.371172
2306,2.393358
22640,2.429165
4812,2.460628
531,2.491491
652,2.491733
33066,2.501009
11801,2.50768
11433,2.51471
1586,2.515188
101935,2.52349
2766,2.555168
1454,2.568969
132,2.605332
10128,2.641432
152430,2.657356
132,2.662684
713590,2.666913
16449,2.677721
510270,2.682183
62273,2.682551
132,2.709093
1861,2.760515
4997,2.763797
32183,2.788247
28203,2.819616
188,2.829825
132,2.829845
132,2.859078
132,2.874831
132,2.877107
6717,2.880421
140,2.883029
132,2.888551
132,2.89541
231583,2.896035
14649,2.896089
188,2.905811
132,2.905864
140,2.909935
132,2.921413
132,2.926216
594179,2.934438
132,2.935134
132,2.937042
132,2.937339
188,2.944347
132,2.944383
132,2.945864
132,2.948357
188,2.949984
132,2.950012
132,2.955311
132,2.955782
132,2.973507
132,2.974241
188,2.974255
140,2.974314
4154,2.980287
132,2.987635
132,2.989622
196,2.995861
140,2.995898
132,2.996507
132,3.003683
132,3.010068
196,3.03095
140,3.030982
132,3.046541
188,3.059764
132,3.059767
798,3.065923
2490,3.065944
51757,3.069919
15939,3.070065
132,3.091565
188,3.134578
132,3.134596
132,3.156098
23862,3.328135
1188,3.403315
182006,3.525185
46909,3.550847
600,3.561394
33015,3.571232
4870,3.588634
3186,3.594933
4684,3.596317
778064,3.711828
194351,3.749875
44380,3.757992
187189,3.773862
37403,3.788837
1294,3.792151
25557,3.84727
33263,3.867362
2674,3.955699
29556,3.956341
46507,3.9855
3409,3.986021
1235477,3.988403
15875,3.988542
828,4.011879
1642,4.017698
1456,4.018648
2380,4.019865
9151,4.021732
1126,4.02323
5623,4.046406
713163,4.167962
1138,4.190889
433256,4.194556
55913,4.194586
3361,4.31616
1638,4.327699
590,4.352503
600,4.418513
2699,4.510693
7632,4.510712
5732,4.573728
17280,4.643326
95087,4.655412
526,4.740544
438,4.795442
343843,4.808577
7627,4.814397
96013,4.943395
30328,4.946314
1536,5.000289
128,5.007982
256,5.010265
2678,5.046594
108964,5.049791
528,5.059995
256,5.064265
1517,5.089856
11573,5.090594
78826,5.201509
1151,5.207485
2133,5.250767
29456,5.251277
33735,5.261163
16623,5.276747
42689,5.342746
1578,5.343163
29444,5.346298
1153,5.346504
147161,5.514467
52188,5.515374
624020,5.538305
68841,5.658944
1645,5.802095
17463,5.803419
713838,5.852344
15658,5.888079
3077,5.890258
664872,5.901925
39695,5.938682
1593,5.954034
1389,5.969967
1085,5.997283
140,6.04
140,6.04123
60023,6.084361
205925,6.126518
783,6.14439
2804,6.167283
3314,6.205787
1247,6.226351
17093,6.258374
3157,6.303904
349,6.314832
9493,6.330734
1268,6.334715
1528,6.357317
1217,6.374559
11084,6.380871
1585,6.42386
320,6.499766
320,6.499791
5154,6.515548
282,6.54565
204,6.545663
10451,6.637603
2220,6.648446
2251,6.648522
1506,6.680879
11085,6.712411
1527,6.754794
2825316,6.779147
25802,6.817031
13099,6.872689
900,6.877447
1441,6.877451
54541,6.889001
2074,6.915496
2687,6.968536
249574,6.987169
13218,7.017736
7711,7.099515
352023,7.110319
2322,7.115379
1388,7.116264
10820,7.201955
9918,7.24047
1491,7.244958
3269,7.253851
1626,7.346073
1297,7.346165
2753,7.441404
712036,7.442135
530719,7.512059
72747,7.584628
13279,7.612756
873,7.652044
422192,7.734609
5654,7.813552
56336,7.828346
18947,7.828442
8672,7.832183
2927,7.864585
2086,8.020411
297890,8.288307
49866,8.316907
2679191,8.443889
54472,8.44592
18266,8.47401
75025,8.560657
54681,8.560782
50640,8.618459
129755,8.677643
2475,8.70625
30004,8.725894
5663,8.725984
9659,8.739858
398797,8.777131
525040,8.801648
13069,8.894148
198,8.919396
198,8.921098
282,8.969387
198,8.970145
198,9.020337
2212,9.044279
198,9.077682
198,9.077699
2096,9.080032
2026,9.095516
2026,9.142681
34823,9.64438
5231,9.664765
5699,9.67643
1362,9.684836
23987,9.743977
1424,9.748782
2346,9.835181
1518,10.031819
179966,10.052435
5316,10.135265
11575,10.198598
1683,10.198796
247109,10.216616
196622,10.421853
577104,10.460021
33069,10.488937
43901,10.505849
37936,10.509159
4288,10.551961
726986,10.747564
1592,10.78032
8584,10.806417
1707,10.806453
5689,11.103723
1982,11.112576
5740,11.115402
20958,11.166415
31286,11.166668
2821,11.348105
26873,11.58282
1803,11.605445
2530,11.625458
134,11.749506
44771,11.872257
3266,11.954945
6154,12.033907
653,12.053118
6375,12.079911
3026,12.081055
80914,12.102561
45120,12.102651
1432,12.190595
37698,12.200103
2205,12.283717
71186,12.314994
98181,12.373568
4526,12.386216
45161,12.521104
2569,12.615017
6428,12.68426
2900,12.789244
2392,12.831736
294,12.840956
26584,12.943789
225408,13.010517
1494,13.037758
1262,13.094175
3106,13.129601
5777,13.320724
52969,13.564688
1910,13.597492
14116,13.636178
2837,13.64823
947329,13.671967
24962,13.841465
3414,13.884591
31428,14.11272
1725,14.191999
32116,14.240096
1790,14.31921
514411,14.400074
12109,14.503665
4259,14.583757
54489,14.605187
89140,14.670161
118040,14.68613
2616,14.687748
3625,14.753408
3550,14.775092
2667,14.838907
199391,14.981492
502475,15.034957
68310,15.047907
4473,15.071961
1762,15.072868
6980,15.113657
2218,15.114614
2474,15.1178
12562,15.124192
62042,15.124814
9370,15.129725
1301,15.129822
25905,15.244145
90338,15.27131
3060,15.271499
5639,15.329547
531,15.352791
1070,15.35291
114628,15.366236
809,15.370167
1062,15.390823
1256,15.391084
263968,15.516799
799084,15.632512
29650,15.696052
57678,15.698549
407386,15.712358
5944,15.77841
116952,15.785632
9870,15.801099
925,15.819658
34372,15.869178
1890,15.86919
418675,15.88866
3815,15.91148
134840,15.943084
10240,16.029456
11193,16.075111
1436,16.200987
323252,16.225831
88551,16.246452
560031,16.264048
3424,16.323389
4350,16.328874
6622,16.340168
5379,16.466085
717612,16.488558
8133,16.532172
3040,16.543965
149357,16.544136
84531,16.596882
2980,16.664897
449500,16.707105
4986,16.721756
1417,16.722774
538,16.734443
94481,16.742802
8070,16.747063
702,16.768075
10775,16.795328
644059,16.81496
22434,16.819927
1314,16.82004
4829,16.824694
8306,16.897107
906,16.897211
505157,16.972408
27913,17.13434
27633,17.20429
317523,17.497567
8658,17.590233
5715,17.729557
833,17.766507
15812,17.821605
3530,17.849879
1058,17.849992
8230,17.9448
28636,18.20919
24460,18.209265
19120,18.271989
644776,18.286225
407274,18.332685
112007,18.333745
492731,18.34942
24630,18.349489
16994,18.378234
66928,18.383215
14629,18.945454
2034,18.945639
11373,19.010612
642,19.196347
12015,19.589997
3438,19.731085
66889,19.737977
23965,19.782133
4320,19.785513
2970,19.820395
3107,19.824928
1971,19.943671
769,19.954189
611641,19.959002
446724,19.995426
141059,20.079737
13368,20.08528
571,20.258671
4745,20.273819
1166,20.273899
47907,20.556494
3006,20.708383
3291,20.755402
249609,20.787413
23878,20.78834
4183,20.888357
312,20.999668
4024,21.012693
3297,21.025931
15203,21.151285
1741,21.319021
65524,21.333669
3111,21.348425
524,21.360434
26692,21.507034
63530,21.577631
7335,21.597375
620149,21.666426
11520,21.776047
1740,21.855938
38501,21.89331
1349300,22.046762
23319,22.072729
1647,22.072921
130221,22.090043
9698,22.090074
48847,22.110029
32929,22.13989
13668,22.315371
39121,22.417911
47503,22.425679
531,22.470069
1012,22.470076
2654,22.504981
78373,22.534094
3169,22.53411
1952,22.731617
652,22.860808
71260,22.889169
280,23.67373
1280,23.858748
6897,23.858754
788,24.077096
15276,24.07718
98794,24.303238
17302,24.427564
543642,24.428689
27671,24.611463
38699,24.995687
6222,24.996029
2873288,25.231955
86285,25.257784
6686,25.257889
69079,25.311085
5944,25.311302
1074,25.324982
243135,25.368159
27917,25.368168
30655,25.368997
1261,25.489908
38458,25.50374
1144,25.516606
2514,25.865317
24687,25.906181
1859,25.906215
759,26.008009
3823,26.008012
66709,26.171423
813735,26.175811
6106,26.181863
107495,26.225621
86934,26.248716
22479,26.346586
1805,26.346726
1992,26.88706
2612,27.065898
35738,27.078808
17603,27.2851
2420,27.311494
26981,27.329572
1811,27.406894
1454,27.428484
165752,27.579631
26634,27.579883
355225,28.270421
24083,28.352348
38999,28.437802
3456,28.437945
62276,28.63386
7179,28.677111
93952,28.786779
31441,28.817192
3313190,29.013922
127847,29.014028
714673,29.051341
17262,29.051488
24051,29.181351
11178,29.433397
4306,29.437851
531,29.929673
1087,29.92979
531,29.965691
1063,29.965791
531,29.999856
702,29.99997
531,30.039245
1076,30.039403
648956,30.135851
531,30.192547
862,30.192678
46927,30.26733
75148,30.56572
3255,30.565759
38229,30.592666
696,30.596425
8265,30.633897
7831,30.679427
144682,30.68018
183986,30.734917
15399,30.735086
174593,30.89045
262854,31.139566
5047,31.208535
1319501,31.757493
144984,31.778943
7976,31.790462
2282,31.84105
253761,31.848902
286,31.861067
5160,31.924957
234937,32.065854
90860,32.116785
4018,32.17334
25402,32.259085
2046,32.394248
38189,32.42135
11985,32.461412
37494,32.621786
16545,32.849907
1450,32.849914
37102,33.006097
2716331,33.050446
183787,33.125286
173371,33.139898
7193,33.290161
8589,33.423485
983357,33.645422
27182,33.728863
1014463,33.786794
273499,33.787715
11977,33.947355
594,34.020515
704,34.080337
15199,34.085748
8800,34.222183
2134,34.222414
5050,34.362907
505,34.84883
25015,35.91236
388110,35.959975
22895,35.960173
180581,36.483239
114452,36.930489
42334,37.30298
777272,37.309641
80679,37.309641
20647,37.435307
13939,38.071366
107041,38.255479
97060,38.259734
12046,38.302566
6040,38.361512
259958,38.39528
30340,38.395342
36330,38.480358
1692,38.550147
5689,38.756063
1466,39.532572
3892,39.545631
4090,39.549844
313,39.654378
825,39.775182
498,40.001939
2454,40.437087
113061,40.651704
27877,40.689322
690436,40.689357
7518,40.706097
134,41.217181
503640,41.346102
46424,41.346184
2528,41.525264
272,41.634874
11442,41.735403
8147,41.888466
4361,41.8925
213512,41.914314
22772,41.981599
306,42.145969
138344,42.278215
5119,42.278317
294783,42.387569
20395,42.719608
4947,42.723395
121070,42.739822
27248,42.739904
273578,43.095881
24079,43.095925
63229,43.220255
38577,43.557258
296008,43.645345
39551,43.703207
7553,43.748187
4275,44.013087
11755,44.035453
2416,44.145391
12624,44.391945
7358,44.44709
656,44.447107
6504,44.593117
3481,45.094834
474,45.316682
1825,45.802535
62238,45.866822
6304,45.866996
101247,45.936041
10906,45.936193
945304,46.523501
199162,46.523556
8519,47.023755
232098,47.303509
19611,47.303864
4345,47.316668
48447,47.334848
215039,47.419507
3862,47.531149
5095,47.531621
2562,47.547162
2188,47.54719
13484,47.625049
83016,47.625054
37218,47.706859
4680,47.706996
924124,48.229764
8220,48.248572
835,48.260978
86903,48.510108
23828,48.872943
1269358,49.530466
143153,49.530552
17149,49.833841
1931,49.848023
14333,50.568468
4274110,50.865795
133154,50.865916
6748,51.51256
5190,51.726476
1357163,53.059792
51140,53.068219
21065,53.399836
35627,53.483549
7496,53.57655
224892,54.105722
29373,54.105744
3157,54.348155
1098,54.539727
112085,55.201775
3951,55.999234
4399,55.99924
330639,56.104462
9230,56.184859
13889,56.442553
618,56.628394
7727,56.642208
763,57.081764
194,57.247853
72928,57.55269
5082,57.732792
208932,57.752764
45829,57.754376
182045,57.980041
578067,58.648434
116063,59.15431
26323,59.237634
40128,59.409216
877235,59.449063
42607,59.449305
130,60.007782
142,60.010747
62371,60.061641
7523202,60.217694
238881,60.293171
7497567,60.38191
289643,60.383579
7740,60.531986
7165,60.53255
860268,60.69553
206685,60.718911
923938,60.844208
312019,60.844329
144231,60.897993
288592,60.98422
10461,61.032568
4516,61.214711
239426,61.38159
180793,61.384589
1475338,61.537067
11203,61.548899
13834,61.697431
291005,61.98104
9852,62.041266
685199,62.685529
10352,62.701585
3870,62.927755
30233,62.989964
8322,63.385158
434,63.490238
444,63.494546
516,63.517739
990,63.550179
990,63.569317
990,63.609584
40510,63.694394
586256,63.707081
40275,63.707214
5423,63.717189
5176,64.021134
321106,64.179988
2394,64.196669
172533,64.238676
34148,64.238883
74402,64.259353
5395,64.386833
756,64.393092
578180,64.419819
58720,64.502113
39874,64.515607
2217,64.749261
1740,64.84502
4573,65.323704
3341,65.328661
70923,65.540771
3805,65.541094
3907,65.578878
6869,65.618099
17087,66.047671
1786,66.222081
409544,66.270789
51348,66.270808
54781,66.332495
1274,66.506467
3368,67.24144
24804,67.250076
301830,67.38352
13143128,67.38359
21208,67.402999
9525,67.900118
159334,67.979435
220818,67.980609
2417,68.16081
178408,68.450988
68762,68.513756
781722,69.034629
72671,69.038871
51138,69.112505
1783,69.173793
37105,69.293479
9320,69.405619
126380,70.092419
45764,70.092521
340,70.100955
400,70.341957
40201,70.634954
1122,70.878428
7692,71.236748
495,71.376121
7969,71.498784
71272,71.744812
256,71.780953
513,72.361659
3426,72.679651
25754,72.855446
3138,72.898703
967684,72.964736
140193,72.965858
30718,73.927057
169972,73.92873
71904,74.250059
9633,74.292473
813489,75.265507
80186,75.267345
664370,75.559644
62891,75.574494
831419,76.170656
77500,76.170763
4119912,77.167787
136589,77.228586
202960,77.953329
58197,77.968376
61174,77.970839
50129,78.008272
55737,78.023063
88501,78.101457
4081,78.50574
5210,78.729249
32269,79.720171
1319594,80.045536
78989,80.12059
69298,80.896048
1307027,81.30112
143693,81.301294
57426,81.57793
8304,81.577972
91381,83.50384
30620,83.664825
13727,83.846204
3478,83.846206
7506,83.925089
3819,83.989647
5104,84.640743
27209,85.36404
3591,85.589149
10126,85.675895
256,86.908636
128,86.908746
185868,88.071019
95634,88.215253
6800,88.215487
9213,88.232729
3624,88.403285
128,89.278097
128,89.349884
38449,89.377359
1634,89.45749
121518,89.713747
15101,89.756951
256569,90.153255
33304,90.153344
188702,90.598513
5790,90.683421
18631,90.81176
1163,90.813804
4831523,91.090815
181810,91.128753
7442,91.182673
6814,91.214459
1024,91.274712
680,91.451607
2084,92.052753
1466,92.052881
282034,92.714117
14276,92.750992
2404,92.780962
5855,92.821541
61415,94.646201
136112,94.646398
760324,94.851389
33374,95.278172
1733,95.399137
11691,95.740427
122691,95.790113
23060,96.403934
4822,96.535412
118832,96.639535
39278,96.640788
59051,97.125313
30452,97.13008
80318,97.225792
11657,97.234077
224960,97.368725
5254,97.368772
550324,97.545758
11783,98.071066
3100,98.094897
32986,98.102005
553250,98.11665
227806,98.255325
14572,98.441067
809326,98.686678
610262,98.698431
44082,98.698752
58989,98.767098
200947,99.189988
58898,99.550885
802123,99.550911
209940,99.716739
11214,99.847681
6180,100.297679
625,100.29772
11694,101.719796
1158,101.937427
303005,104.272234
30019,104.272365
45270,105.142618
370,106.259291
15739,106.392927
528,106.43275
2536,106.555733
1078,106.592073
762,106.6994
1198530,107.86163
hlswsv35

hlswsv351#

看起来你的X值中有一些零。log(0)没有定义,log(veryclosetozero)10^{-verymuch}

编辑:

此外,数字的浮点表示并不总是完全精确的,所以0.0最终可能被存储为0.00000000000000000001或类似的。在这种情况下,log函数不会抛出错误,而只是计算非常非常小的东西的对数。

7xllpg7q

7xllpg7q2#

import pandas as pd

# path to data from the link in the OP
data_path = 'https://gist.githubusercontent.com/ecenm/25df526d4398af2c3e41ae6df6c51155/raw/a6a72e4ed46604b019bb14a275044aff829fb2bc/iplevel.csv'
df = pd.read_csv(data_path)

# understand the distribution
display(df.describe())
  • 可以看到'Length'具有宽分布,标准差和方差较大df.Length.var() → 2565470083120.9233
Length         Time
count  2.715000e+03  2715.000000
mean   1.748645e+05    94.257661
std    1.601708e+06   117.789762
min    6.400000e+01     0.000000
25%    6.290000e+02     0.659420
50%    4.396000e+03    25.368997
75%    3.863800e+04   182.597445
max    7.349447e+07   344.968822
ax = df.plot(kind='box', column='Length', figsize=(12, 6), grid=False, logy='sym')

ax = df.plot(kind='box', column='Time', figsize=(12, 6), grid=False, logy='sym')

  • pandas.DataFrame.plotlogy=Truelogy='sym'配合使用
ax = df.plot(kind='scatter', x='Time', y='Length', logy=True, figsize=(10, 7), s=1,
             xlabel='Duration (in seconds)', ylabel='Size (in bytes)', title='Size Vs Duration (at IP level)')

  • pandas.DataFrame.plotlogy=Truelogx=True配合使用
ax = df.plot(kind='scatter', x='Time', y='Length', logx=True, logy=True, figsize=(10, 7),
             xlabel='Duration (in seconds)', ylabel='Size (in bytes)', title='Size Vs Duration (at IP level)')

  • pandas.DataFrame.plotlogx='sym'logy='sym'配合使用
ax = df.plot(kind='scatter', x='Time', y='Length', logx='sym', logy='sym', figsize=(10, 7), s=1,
             xlabel='Duration (in seconds)', ylabel='Size (in bytes)', title='Size Vs Duration (at IP level)')

  • 使用OP中的原始代码绘图

fbcarpbf

fbcarpbf3#

我在绘制包含很多0的数字时遇到了类似的问题。如果你的数字在csv文件中的表示格式类似于10E-38,请尝试将所有行乘以1,然后使用pandas读取数据。
这解决了我的问题。

相关问题