1

I have these two plots that are overlapping. I will put the code with less rows since only 30K is allowed. How can I solve it?

enter image description here

    \documentclass{book}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{pgfplots, pgfplotstable}
\usetikzlibrary{positioning}

\pgfplotsset{compat=1.16}
\captionsetup[subfigure]{font=footnotesize}
\usepackage{tikz}

\begin{document}

\begin{figure}
    \centering


\begin{subfigure}{0.3\textwidth}
    \begin{tikzpicture}


    \begin{axis}[
    axis background/.style={fill=black!20},
    axis line style={white},
    legend cell align={left},
    legend style={at={(0.97,0.03)}, anchor=south east, draw=none, fill=black!20},
    tick align=outside,
    tick pos=left,
    x grid style={white},
    xlabel={Ratings},
    xmajorgrids,
    xmin=-35.8, xmax=773.8,
    xtick style={color=white!15.0!black},
    y grid style={white},
    ylabel={ECDF},
    ymajorgrids,
    ymin=-0.0499702734839477, ymax=1.0493757431629,
    ytick style={color=white!15.0!black}
    ]
    \addplot [thick, orange, mark=*, mark size=1, mark options={solid}, only marks]
    table {%
        20 0
        20 0.00106044538706257
        20 0.00212089077412513
        20 0.0031813361611877
        20 0.00424178154825027
        20 0.00530222693531283
        20 0.0063626723223754
        20 0.00742311770943796
        20 0.00848356309650053
        20 0.0095440084835631
        20 0.0106044538706257
        20 0.0116648992576882
        20 0.0127253446447508
        20 0.0137857900318134
        20 0.0148462354188759
        20 0.0159066808059385
        20 0.0169671261930011
        20 0.0180275715800636
        20 0.0190880169671262
        20 0.0201484623541888
        20 0.0212089077412513
        20 0.0222693531283139
        20 0.0233297985153765
        20 0.024390243902439
        20 0.0254506892895016
        20 0.0265111346765642
        20 0.0275715800636267
        20 0.0286320254506893
        20 0.0296924708377519
        20 0.0307529162248144
        20 0.031813361611877
        20 0.0328738069989396
        21 0.0339342523860021
        21 0.0349946977730647
        21 0.0360551431601273
        21 0.0371155885471898
        21 0.0381760339342524
        21 0.039236479321315
        21 0.0402969247083775
        21 0.0413573700954401
        21 0.0424178154825027
        21 0.0434782608695652
        21 0.0445387062566278
        21 0.0455991516436903
        21 0.0466595970307529
        21 0.0477200424178155
        21 0.0487804878048781
        21 0.0498409331919406
        21 0.0509013785790032
        21 0.0519618239660657
        21 0.0530222693531283
        21 0.0540827147401909
        21 0.0551431601272534
        21 0.056203605514316
        21 0.0572640509013786
        21 0.0583244962884411
        22 0.0593849416755037
        22 0.0604453870625663
        22 0.0615058324496288
        22 0.0625662778366914
        22 0.063626723223754
        22 0.0646871686108165
        22 0.0657476139978791
        22 0.0668080593849417
        22 0.0678685047720042
        22 0.0689289501590668
        22 0.0699893955461294
        22 0.0710498409331919
        22 0.0721102863202545
        22 0.0731707317073171
        22 0.0742311770943796
        22 0.0752916224814422
        22 0.0763520678685048
        22 0.0774125132555673
        22 0.0784729586426299
        22 0.0795334040296925
        22 0.080593849416755
        22 0.0816542948038176
        22 0.0827147401908802
        23 0.0837751855779427
        23 0.0848356309650053
        23 0.0858960763520679
        23 0.0869565217391304
        23 0.088016967126193
        23 0.0890774125132556
        23 0.0901378579003181
        23 0.0911983032873807
        23 0.0922587486744433
        23 0.0933191940615058
        23 0.0943796394485684
        23 0.095440084835631
        23 0.0965005302226935
        23 0.0975609756097561
        23 0.0986214209968187
        23 0.0996818663838812
        23 0.100742311770944
        23 0.101802757158006
        23 0.102863202545069
        23 0.103923647932131
        23 0.104984093319194
        24 0.106044538706257
        24 0.107104984093319
        24 0.108165429480382
        24 0.109225874867444
        24 0.110286320254507
        24 0.111346765641569
        24 0.112407211028632
        24 0.113467656415695
        24 0.114528101802757
        24 0.11558854718982
        24 0.116648992576882
        24 0.117709437963945
        24 0.118769883351007
        24 0.11983032873807
        24 0.120890774125133
        24 0.121951219512195
        24 0.123011664899258
        24 0.12407211028632
        24 0.125132555673383
        24 0.126193001060445
        24 0.127253446447508
        25 0.128313891834571
        25 0.129374337221633
        25 0.130434782608696
        25 0.131495227995758
        25 0.132555673382821
        25 0.133616118769883
        25 0.134676564156946
        25 0.135737009544008
        25 0.136797454931071
        25 0.137857900318134
        25 0.138918345705196
        25 0.139978791092259
        25 0.141039236479321
        25 0.142099681866384
        25 0.143160127253446
        25 0.144220572640509
        26 0.145281018027572
        26 0.146341463414634
        26 0.147401908801697
        26 0.148462354188759
        26 0.149522799575822
        26 0.150583244962884
        26 0.151643690349947
        26 0.15270413573701
        26 0.153764581124072
        26 0.154825026511135
        26 0.155885471898197
        26 0.15694591728526
        26 0.158006362672322
        26 0.159066808059385
        26 0.160127253446448
        26 0.16118769883351
        26 0.162248144220573
        26 0.163308589607635
        26 0.164369034994698
        27 0.16542948038176
        27 0.166489925768823
        27 0.167550371155885
        27 0.168610816542948
        27 0.169671261930011
        27 0.170731707317073
        27 0.171792152704136
        27 0.172852598091198
        27 0.173913043478261
        27 0.174973488865323
        27 0.176033934252386
        27 0.177094379639449
        27 0.178154825026511
        27 0.179215270413574
        27 0.180275715800636
        27 0.181336161187699
        28 0.182396606574761
        28 0.183457051961824
        28 0.184517497348887
        28 0.185577942735949
        28 0.186638388123012
        28 0.187698833510074
        28 0.188759278897137
        28 0.189819724284199
        28 0.190880169671262
        28 0.191940615058324
        28 0.193001060445387
        28 0.19406150583245
        28 0.195121951219512
        28 0.196182396606575
        28 0.197242841993637
        29 0.1983032873807
        29 0.199363732767762
        29 0.200424178154825
        29 0.201484623541888
        29 0.20254506892895
        29 0.203605514316013
        29 0.204665959703075
        29 0.205726405090138
        29 0.2067868504772
        29 0.207847295864263
        29 0.208907741251326
        29 0.209968186638388
        30 0.211028632025451
        30 0.212089077412513
        30 0.213149522799576
        30 0.214209968186638
        30 0.215270413573701
        30 0.216330858960764
        30 0.217391304347826
        30 0.218451749734889
        30 0.219512195121951
        30 0.220572640509014
        30 0.221633085896076
        30 0.222693531283139
        30 0.223753976670201
        30 0.224814422057264
        31 0.225874867444327
        31 0.226935312831389
        31 0.227995758218452
        31 0.229056203605514
        31 0.230116648992577
        31 0.231177094379639
        31 0.232237539766702
        31 0.233297985153765
        32 0.234358430540827
        32 0.23541887592789
        32 0.236479321314952
        32 0.237539766702015
        32 0.238600212089077
        32 0.23966065747614
        32 0.240721102863203
        32 0.241781548250265
        32 0.242841993637328
        33 0.24390243902439
        33 0.244962884411453
        33 0.246023329798515
        33 0.247083775185578
        33 0.248144220572641
        33 0.249204665959703
        33 0.250265111346766
        33 0.251325556733828
        33 0.252386002120891
        33 0.253446447507953
        33 0.254506892895016
        33 0.255567338282078
        33 0.256627783669141
        33 0.257688229056204
        33 0.258748674443266
        33 0.259809119830329
        34 0.260869565217391
        34 0.261930010604454
        34 0.262990455991516
        34 0.264050901378579
        34 0.265111346765642
        34 0.266171792152704
        34 0.267232237539767
        34 0.268292682926829
        35 0.269353128313892
        35 0.270413573700954
        35 0.271474019088017
        35 0.27253446447508
        35 0.273594909862142
        35 0.274655355249205
        35 0.275715800636267
        35 0.27677624602333
        35 0.277836691410392
        35 0.278897136797455
        35 0.279957582184517
        36 0.28101802757158
        36 0.282078472958643
        36 0.283138918345705
        36 0.284199363732768
        36 0.28525980911983
        36 0.286320254506893
        36 0.287380699893955
        36 0.288441145281018
        37 0.289501590668081
        37 0.290562036055143
        37 0.291622481442206
        37 0.292682926829268
        37 0.293743372216331
        37 0.294803817603393
        37 0.295864262990456
        37 0.296924708377519
        38 0.297985153764581
        38 0.299045599151644
        38 0.300106044538706
        38 0.301166489925769
        38 0.302226935312831
        38 0.303287380699894
        38 0.304347826086957
        38 0.305408271474019
        38 0.306468716861082
        39 0.307529162248144
        39 0.308589607635207
        39 0.309650053022269
        39 0.310710498409332
        39 0.311770943796394
        39 0.312831389183457
        39 0.31389183457052
        39 0.314952279957582
        40 0.316012725344645
        40 0.317073170731707
        40 0.31813361611877
        40 0.319194061505832
        40 0.320254506892895
        40 0.321314952279958
        40 0.32237539766702
        41 0.323435843054083
        41 0.324496288441145
        41 0.325556733828208
        41 0.32661717921527
        41 0.327677624602333
        41 0.328738069989396
        41 0.329798515376458
        41 0.330858960763521
        42 0.331919406150583
        42 0.332979851537646
        42 0.334040296924708
        42 0.335100742311771
        42 0.336161187698834
        42 0.337221633085896
        42 0.338282078472959
        42 0.339342523860021
        43 0.340402969247084
        43 0.341463414634146
        43 0.342523860021209
        43 0.343584305408271
        43 0.344644750795334
        43 0.345705196182397
        43 0.346765641569459
        43 0.347826086956522
        43 0.348886532343584
        43 0.349946977730647
        44 0.351007423117709
        44 0.352067868504772
        44 0.353128313891835
        44 0.354188759278897
        44 0.35524920466596
        44 0.356309650053022
        44 0.357370095440085
        44 0.358430540827147
        45 0.35949098621421
        45 0.360551431601273
        45 0.361611876988335
        45 0.362672322375398
        45 0.36373276776246
        46 0.364793213149523
        46 0.365853658536585
        46 0.366914103923648
        46 0.36797454931071
        46 0.369034994697773
        46 0.370095440084836
        46 0.371155885471898
        47 0.372216330858961
        47 0.373276776246023
        47 0.374337221633086
        47 0.375397667020148
        47 0.376458112407211
        47 0.377518557794274
        47 0.378579003181336
        47 0.379639448568399
        47 0.380699893955461
        47 0.381760339342524
        47 0.382820784729586
        47 0.383881230116649
        48 0.384941675503712
        48 0.386002120890774
        48 0.387062566277837
        48 0.388123011664899
        48 0.389183457051962
        48 0.390243902439024
        49 0.391304347826087
        49 0.39236479321315
        49 0.393425238600212
        49 0.394485683987275
        49 0.395546129374337
        49 0.3966065747614
        50 0.397667020148462
        50 0.398727465535525
        50 0.399787910922587
        50 0.40084835630965
        50 0.401908801696713
        51 0.402969247083775
        51 0.404029692470838
        51 0.4050901378579
        51 0.406150583244963
        51 0.407211028632025
        51 0.408271474019088
        51 0.409331919406151
        51 0.410392364793213
        51 0.411452810180276
        51 0.412513255567338
        51 0.413573700954401
        51 0.414634146341463
        52 0.415694591728526
        52 0.416755037115589
        52 0.417815482502651
        53 0.418875927889714
        53 0.419936373276776
        53 0.420996818663839
        53 0.422057264050901
        53 0.423117709437964
        53 0.424178154825027
        53 0.425238600212089
        53 0.426299045599152
        53 0.427359490986214
        54 0.428419936373277
        54 0.429480381760339
        54 0.430540827147402
        54 0.431601272534464
        54 0.432661717921527
        54 0.43372216330859
        55 0.434782608695652
        55 0.435843054082715
        55 0.436903499469777
        55 0.43796394485684
        55 0.439024390243902
        55 0.440084835630965
        56 0.441145281018028
        56 0.44220572640509
        56 0.443266171792153
        56 0.444326617179215
        56 0.445387062566278
        56 0.44644750795334
        57 0.447507953340403
        57 0.448568398727466
        57 0.449628844114528
        57 0.450689289501591
        57 0.451749734888653
        57 0.452810180275716
        57 0.453870625662778
        57 0.454931071049841
        58 0.455991516436903
        58 0.457051961823966
        58 0.458112407211029
        58 0.459172852598091
        58 0.460233297985154
        58 0.461293743372216
        58 0.462354188759279
        58 0.463414634146341
        58 0.464475079533404
        58 0.465535524920467
        59 0.466595970307529
        59 0.467656415694592
        59 0.468716861081654
        59 0.469777306468717
        59 0.470837751855779
        59 0.471898197242842
        60 0.472958642629905
        60 0.474019088016967
        60 0.47507953340403
        61 0.476139978791092
        61 0.477200424178155
        62 0.478260869565217
        62 0.47932131495228
        62 0.480381760339343
        62 0.481442205726405
        62 0.482502651113468
        62 0.48356309650053
        62 0.484623541887593
        63 0.485683987274655
        63 0.486744432661718
        63 0.48780487804878
        63 0.488865323435843
        63 0.489925768822906
        63 0.490986214209968
        64 0.492046659597031
        64 0.493107104984093
        64 0.494167550371156
        64 0.495227995758218
        64 0.496288441145281
        64 0.497348886532344
        64 0.498409331919406
        65 0.499469777306469
        65 0.500530222693531
        65 0.501590668080594
        65 0.502651113467656
        65 0.503711558854719
        65 0.504772004241782
        66 0.505832449628844
        66 0.506892895015907
        66 0.507953340402969
        66 0.509013785790032
        66 0.510074231177094
        66 0.511134676564157
        67 0.51219512195122
        321 0.983947681331748
        324 0.984542211652794
        326 0.985136741973841
        331 0.985731272294887
        336 0.986325802615933
        344 0.98692033293698
        350 0.987514863258026
        350 0.988109393579073
        365 0.988703923900119
        367 0.989298454221165
        378 0.989892984542212
        384 0.990487514863258
        390 0.991082045184304
        392 0.991676575505351
        394 0.992271105826397
        413 0.992865636147443
        420 0.99346016646849
        429 0.994054696789536
        431 0.994649227110583
        452 0.995243757431629
        478 0.995838287752675
        481 0.996432818073722
        485 0.997027348394768
        507 0.997621878715815
        508 0.998216409036861
        509 0.998810939357907
        583 0.999405469678954
    };
    \addlegendentry{Movies}
    \end{axis}


    \end{tikzpicture}
\caption{ML }   
\end{subfigure}
\begin{subfigure}{0.3\textwidth}
    \begin{tikzpicture}


    \begin{axis}[
    axis background/.style={fill=black!20},
    axis line style={white},
    legend cell align={left},
    legend style={at={(0.97,0.03)}, anchor=south east, draw=none, fill=black!20},
    tick align=outside,
    tick pos=left,
    x grid style={white},
    xlabel={Ratings},
    xmajorgrids,
    xmin=-35.8, xmax=773.8,
    xtick style={color=white!15.0!black},
    y grid style={white},
    ylabel={ECDF},
    ymajorgrids,
    ymin=-0.0499702734839477, ymax=1.0493757431629,
    ytick style={color=white!15.0!black}
    ]
    \addplot [thick, orange, mark=*, mark size=1, mark options={solid}, only marks]
    table {%
        20 0
        20 0.00106044538706257
        20 0.00212089077412513
        20 0.0031813361611877
        20 0.00424178154825027
        20 0.00530222693531283
        20 0.0063626723223754
        20 0.00742311770943796
        20 0.00848356309650053
        20 0.0095440084835631
        20 0.0106044538706257
        20 0.0116648992576882
        20 0.0127253446447508
        20 0.0137857900318134
        33 0.259809119830329
        34 0.260869565217391
        34 0.261930010604454
        34 0.262990455991516
        34 0.264050901378579
        34 0.265111346765642
        34 0.266171792152704
        34 0.267232237539767
        34 0.268292682926829
        35 0.269353128313892
        35 0.270413573700954
        35 0.271474019088017
        35 0.27253446447508
        35 0.273594909862142
        35 0.274655355249205
        35 0.275715800636267
        35 0.27677624602333
        35 0.277836691410392
        35 0.278897136797455
        35 0.279957582184517
        36 0.28101802757158
        36 0.282078472958643
        36 0.283138918345705
        36 0.284199363732768
        36 0.28525980911983
        36 0.286320254506893
        36 0.287380699893955
        36 0.288441145281018
        37 0.289501590668081
        37 0.290562036055143
        37 0.291622481442206
        37 0.292682926829268
        37 0.293743372216331
        37 0.294803817603393
        37 0.295864262990456
        37 0.296924708377519
        38 0.297985153764581
        38 0.299045599151644
        38 0.300106044538706
        38 0.301166489925769
        38 0.302226935312831
        38 0.303287380699894
        38 0.304347826086957
        38 0.305408271474019
        38 0.306468716861082
        39 0.307529162248144
        39 0.308589607635207
        39 0.309650053022269
        39 0.310710498409332
        39 0.311770943796394
        39 0.312831389183457
        39 0.31389183457052
        39 0.314952279957582
        40 0.316012725344645
        40 0.317073170731707
        40 0.31813361611877
        40 0.319194061505832
        40 0.320254506892895
        40 0.321314952279958
        40 0.32237539766702
        41 0.323435843054083
        41 0.324496288441145
        41 0.325556733828208
        41 0.32661717921527
        41 0.327677624602333
        41 0.328738069989396
        41 0.329798515376458
        41 0.330858960763521
        42 0.331919406150583
        42 0.332979851537646
        42 0.334040296924708
        42 0.335100742311771
        42 0.336161187698834
        42 0.337221633085896
        42 0.338282078472959
        42 0.339342523860021
        43 0.340402969247084
        43 0.341463414634146
        43 0.342523860021209
        43 0.343584305408271
        43 0.344644750795334
        43 0.345705196182397
        43 0.346765641569459
        43 0.347826086956522
        43 0.348886532343584
        43 0.349946977730647
        44 0.351007423117709
        44 0.352067868504772
        44 0.353128313891835
        44 0.354188759278897
        44 0.35524920466596
        44 0.356309650053022
        44 0.357370095440085
        44 0.358430540827147
        45 0.35949098621421
        45 0.360551431601273
        45 0.361611876988335
        45 0.362672322375398
        45 0.36373276776246
        46 0.364793213149523
        46 0.365853658536585
        46 0.366914103923648
        46 0.36797454931071
        46 0.369034994697773
        46 0.370095440084836
        46 0.371155885471898
        47 0.372216330858961
        47 0.373276776246023
        47 0.374337221633086
        47 0.375397667020148
        47 0.376458112407211
        47 0.377518557794274
        47 0.378579003181336
        47 0.379639448568399
        47 0.380699893955461
        47 0.381760339342524
        47 0.382820784729586
        47 0.383881230116649
        48 0.384941675503712
        48 0.386002120890774
        48 0.387062566277837
        48 0.388123011664899
        48 0.389183457051962
        48 0.390243902439024
        49 0.391304347826087
        49 0.39236479321315
        49 0.393425238600212
        49 0.394485683987275
        49 0.395546129374337
        49 0.3966065747614
        50 0.397667020148462
        50 0.398727465535525
        50 0.399787910922587
        50 0.40084835630965
        50 0.401908801696713
        51 0.402969247083775
        51 0.404029692470838
        51 0.4050901378579
        51 0.406150583244963
        51 0.407211028632025
        51 0.408271474019088
        51 0.409331919406151
        51 0.410392364793213
        51 0.411452810180276
        51 0.412513255567338
        51 0.413573700954401
        51 0.414634146341463
        52 0.415694591728526
        52 0.416755037115589
        52 0.417815482502651
        53 0.418875927889714
        53 0.419936373276776
        53 0.420996818663839
        53 0.422057264050901
        53 0.423117709437964
        53 0.424178154825027
        53 0.425238600212089
        53 0.426299045599152
        53 0.427359490986214
        54 0.428419936373277
        54 0.429480381760339
        54 0.430540827147402
        54 0.431601272534464
        54 0.432661717921527
        54 0.43372216330859
        55 0.434782608695652
        55 0.435843054082715
        55 0.436903499469777
        55 0.43796394485684
        55 0.439024390243902
        55 0.440084835630965
        56 0.441145281018028
        56 0.44220572640509
        56 0.443266171792153
        56 0.444326617179215
        56 0.445387062566278
        56 0.44644750795334
        57 0.447507953340403
        57 0.448568398727466
        57 0.449628844114528
        57 0.450689289501591
        57 0.451749734888653
        57 0.452810180275716
        57 0.453870625662778
        57 0.454931071049841
        58 0.455991516436903
        58 0.457051961823966
        58 0.458112407211029
        58 0.459172852598091
        58 0.460233297985154
        58 0.461293743372216
        58 0.462354188759279
        58 0.463414634146341
        58 0.464475079533404
        58 0.465535524920467
        59 0.466595970307529
        59 0.467656415694592
        59 0.468716861081654
        59 0.469777306468717
        59 0.470837751855779
        59 0.471898197242842
        60 0.472958642629905
        60 0.474019088016967
        60 0.47507953340403
        61 0.476139978791092
        61 0.477200424178155
        62 0.478260869565217
        62 0.47932131495228
        62 0.480381760339343
        62 0.481442205726405
        62 0.482502651113468
        62 0.48356309650053
        62 0.484623541887593
        63 0.485683987274655
        63 0.486744432661718
        63 0.48780487804878
        63 0.488865323435843
        63 0.489925768822906
        63 0.490986214209968
        64 0.492046659597031
        64 0.493107104984093
        64 0.494167550371156
        64 0.495227995758218
        64 0.496288441145281
        64 0.497348886532344
        64 0.498409331919406
        65 0.499469777306469
        65 0.500530222693531
        65 0.501590668080594
        65 0.502651113467656
        65 0.503711558854719
        65 0.504772004241782
        66 0.505832449628844
        66 0.506892895015907
        66 0.507953340402969
        66 0.509013785790032
        66 0.510074231177094
        66 0.511134676564157
        67 0.51219512195122
        67 0.513255567338282
        67 0.514316012725345
        67 0.515376458112407
        68 0.51643690349947
        68 0.517497348886532
        68 0.518557794273595
        68 0.519618239660657
        68 0.52067868504772
        69 0.521739130434783
        69 0.522799575821845
        70 0.523860021208908
        70 0.52492046659597
        70 0.525980911983033
        71 0.527041357370095
        71 0.528101802757158
        71 0.529162248144221
        71 0.530222693531283
        71 0.531283138918346
        71 0.532343584305408
        71 0.533404029692471
        72 0.534464475079533
        84 0.579003181336161
        84 0.580063626723224
        85 0.581124072110286
        86 0.582184517497349
        86 0.583244962884411
        86 0.584305408271474
        87 0.585365853658537
        87 0.586426299045599
        89 0.587486744432662
        89 0.588547189819724
        89 0.589607635206787
        89 0.590668080593849
        90 0.591728525980912
        90 0.592788971367975
        92 0.593849416755037
        92 0.5949098621421
        93 0.595970307529162
        93 0.597030752916225
        93 0.598091198303287
        93 0.59915164369035
        93 0.600212089077413
        94 0.601272534464475
        95 0.602332979851538
        95 0.6033934252386
        96 0.604453870625663
        96 0.605514316012725
        97 0.606574761399788
        97 0.60763520678685
        98 0.608695652173913
        98 0.609756097560976
        98 0.610816542948038
        98 0.611876988335101
        98 0.612937433722163
        100 0.613997879109226
        100 0.615058324496288
        100 0.616118769883351
        101 0.617179215270414
        101 0.618239660657476
        101 0.619300106044539
        102 0.620360551431601
        102 0.621420996818664
        102 0.622481442205726
        102 0.623541887592789
        102 0.624602332979852
        103 0.625662778366914
        103 0.626723223753977
        2 0.0980975029726516
        2 0.098692033293698
        2 0.0992865636147443
        2 0.0998810939357907
        2 0.100475624256837
        2 0.101070154577883
        2 0.10166468489893
        2 0.102259215219976
        2 0.102853745541023
        3 0.139120095124851
        3 0.139714625445898
        3 0.140309155766944
        3 0.14090368608799
        3 0.141498216409037
        3 0.142092746730083
        3 0.14268727705113
        3 0.143281807372176
        3 0.143876337693222
        3 0.144470868014269
        3 0.145065398335315
        3 0.145659928656361
        3 0.146254458977408
        3 0.146848989298454
        3 0.147443519619501
        3 0.148038049940547
        3 0.148632580261593
        3 0.14922711058264
        3 0.149821640903686
        3 0.150416171224732
        3 0.151010701545779
        3 0.151605231866825
        3 0.152199762187872
        3 0.152794292508918
        3 0.153388822829964
        3 0.153983353151011
        3 0.154577883472057
        3 0.155172413793103
        3 0.15576694411415
        3 0.156361474435196
        3 0.156956004756243
        3 0.157550535077289
        3 0.158145065398335
        3 0.158739595719382
        267 0.967300832342449
        268 0.967895362663496
        272 0.968489892984542
        275 0.969084423305589
        276 0.969678953626635
        276 0.970273483947681
        280 0.970868014268728
        280 0.971462544589774
        283 0.97205707491082
        284 0.972651605231867
        290 0.973246135552913
        291 0.97384066587396
        293 0.974435196195006
        293 0.975029726516052
        293 0.975624256837099
        295 0.976218787158145
        295 0.976813317479191
        297 0.977407847800238
        297 0.978002378121284
        298 0.978596908442331
        298 0.979191438763377
        299 0.979785969084423
        300 0.98038049940547
        301 0.980975029726516
        303 0.981569560047562
        315 0.982164090368609
        316 0.982758620689655
        316 0.983353151010702
        321 0.983947681331748
        324 0.984542211652794
        326 0.985136741973841
        331 0.985731272294887
        336 0.986325802615933
        344 0.98692033293698
        350 0.987514863258026
        350 0.988109393579073
        365 0.988703923900119
        367 0.989298454221165
        378 0.989892984542212
        384 0.990487514863258
        390 0.991082045184304
        392 0.991676575505351
        394 0.992271105826397
        413 0.992865636147443
        420 0.99346016646849
        429 0.994054696789536
        431 0.994649227110583
        452 0.995243757431629
        478 0.995838287752675
        481 0.996432818073722
        485 0.997027348394768
        507 0.997621878715815
        508 0.998216409036861
        509 0.998810939357907
        583 0.999405469678954
    };
    \addlegendentry{Movies}
    \end{axis}

    \end{tikzpicture}
    \caption{ML }
\end{subfigure}



\end{figure}
\end{document}  
  • 2
    This has nothing to do with the number of data points but only with \begin{subfigure}{0.3\textwidth} .... This gives the plots too little space. If you increase the width of the subfigure and/or decrease the width of the plot you will be fine. – user121799 May 31 at 18:20
  • 1
    Replace both \begin{subfigure}{0.3\textwidth} by \begin{subfigure}{0.45\textwidth}, say, and \pgfplotsset{compat=1.16} by \pgfplotsset{compat=1.16,width=0.98\textwidth}. – user121799 May 31 at 18:47
  • 1
    ... which is why pgfplots has a full chapter dedicated to this: Chapter 6 Memory and Speed considerations in v.1.16. So you're lucky indeed. ;-) – user121799 May 31 at 19:11
  • 1
    If you include the files as graphics, which is reasonable because this saves compilation time, use standalone and compile them to pdf. That way you avoid quality loss. – user121799 May 31 at 20:11
  • 1
    Yes, this is how it works. \include{graphics}. – user121799 May 31 at 20:37
1

to big for comment ..

  • I would not use a way standalone -- \includegraphics since with scaling of pdf file of your diagrams will be scaled fonts too. In your case it will become (too)small and not consistent with document text.
  • To my opinion is better to determine diagrams size with width= and height= options (as has already been proposed) and use the option scale only axis:
\documentclass{book}
%\usepackage{geometry}
\usepackage{subcaption}
\usepackage{caption}
\captionsetup[subfigure]{font=footnotesize}
\usepackage{pgfplots, pgfplotstable}
\pgfplotsset{compat=1.16}
\usetikzlibrary{positioning}


%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}[ht]
    \pgfplotsset{width=0.78\linewidth,height=\linewidth,
    scale only axis,
    axis background/.style={fill=black!20},
    axis line style={white},
    legend pos=south east,
    legend style={draw=none, fill=black!20, legend cell align=left},
    tick align=outside,
    tick pos=left,
    grid, grid style={white},
    xmin=-35.8, xmax=773.8,
    }    
\begin{subfigure}{0.48\textwidth}
    \begin{tikzpicture}
    \begin{axis}[
       %xmin=-35.8, xmax=773.8,
       %ymin=-0.0499702734839477, ymax=1.0493757431629,
        xlabel=Ratings,
        ylabel=ECDF
                ]
    \addplot [orange, mark=*, only marks]
    table {%
        20 0
        21 0.0339342523860021
        22 0.0593849416755037
        23 0.0837751855779427
        24 0.106044538706257
        25 0.128313891834571
        26 0.145281018027572
        27 0.16542948038176
        28 0.182396606574761
        29 0.1983032873807
        30 0.211028632025451
        31 0.225874867444327
        32 0.234358430540827
        33 0.24390243902439
        34 0.260869565217391
        35 0.269353128313892
        36 0.28101802757158
        37 0.289501590668081
        38 0.297985153764581
        39 0.307529162248144
        40 0.316012725344645
        41 0.323435843054083
        42 0.331919406150583
        43 0.340402969247084
        44 0.351007423117709
        45 0.35949098621421
        46 0.364793213149523
        47 0.372216330858961
        48 0.384941675503712
        49 0.391304347826087
        50 0.397667020148462
        51 0.402969247083775
        52 0.415694591728526
        53 0.418875927889714
        54 0.428419936373277
        55 0.434782608695652
        56 0.441145281018028
        57 0.447507953340403
        58 0.455991516436903
        59 0.466595970307529
        60 0.472958642629905
        61 0.476139978791092
        62 0.478260869565217
        63 0.485683987274655
        64 0.492046659597031
        65 0.499469777306469
        66 0.505832449628844
        67 0.51219512195122
        321 0.983947681331748
        324 0.984542211652794
        326 0.985136741973841
        331 0.985731272294887
        336 0.986325802615933
        344 0.98692033293698
        350 0.987514863258026
        350 0.988109393579073
        365 0.988703923900119
        367 0.989298454221165
        378 0.989892984542212
        384 0.990487514863258
        390 0.991082045184304
        392 0.991676575505351
        394 0.992271105826397
        413 0.992865636147443
        420 0.99346016646849
        429 0.994054696789536
        431 0.994649227110583
        452 0.995243757431629
        478 0.995838287752675
        481 0.996432818073722
        485 0.997027348394768
        507 0.997621878715815
        508 0.998216409036861
        509 0.998810939357907
        583 0.999405469678954
    };
    \addlegendentry{Movies}
    \end{axis}
    \end{tikzpicture}
\caption{ML}
\end{subfigure}
\hfill
\begin{subfigure}{0.48\textwidth}
    \begin{tikzpicture}
    \begin{axis}[
       %xmin=-35.8, xmax=773.8,
       %ymin=-0.0499702734839477, ymax=1.0493757431629,
        xlabel=Ratings,
        ylabel=ECDF
                ]
    \addplot [orange, mark=*, only marks]
    table {%
        20 0
        33 0.259809119830329
        34 0.260869565217391
        35 0.269353128313892
        36 0.28101802757158
        37 0.289501590668081
        38 0.297985153764581
        39 0.307529162248144
        40 0.316012725344645
        41 0.323435843054083
        42 0.331919406150583
        43 0.340402969247084
        43 0.349946977730647
        44 0.351007423117709
        45 0.35949098621421
        46 0.364793213149523
        47 0.372216330858961
        47 0.373276776246023
        48 0.384941675503712
        49 0.391304347826087
        50 0.397667020148462
        51 0.402969247083775
        51 0.404029692470838
        52 0.415694591728526
        53 0.418875927889714
        54 0.428419936373277
        55 0.434782608695652
        56 0.441145281018028
        57 0.447507953340403
        58 0.455991516436903
        59 0.466595970307529
        60 0.472958642629905
        61 0.476139978791092
        62 0.478260869565217
        63 0.485683987274655
        64 0.492046659597031
        65 0.499469777306469
        66 0.505832449628844
        67 0.51219512195122
        68 0.51643690349947
        69 0.521739130434783
        70 0.523860021208908
        71 0.527041357370095
        71 0.528101802757158
        72 0.534464475079533
        84 0.579003181336161
        84 0.580063626723224
        85 0.581124072110286
        86 0.582184517497349
        87 0.585365853658537
        89 0.587486744432662
        90 0.591728525980912
        92 0.593849416755037
        93 0.595970307529162
        94 0.601272534464475
        95 0.602332979851538
        96 0.604453870625663
        97 0.606574761399788
        98 0.608695652173913
        100 0.613997879109226
        101 0.617179215270414
        102 0.620360551431601
        103 0.625662778366914
        2 0.0980975029726516
        3 0.139120095124851
        267 0.967300832342449
        268 0.967895362663496
        272 0.968489892984542
        275 0.969084423305589
        276 0.969678953626635
        276 0.970273483947681
        280 0.970868014268728
        280 0.971462544589774
        283 0.97205707491082
        284 0.972651605231867
        290 0.973246135552913
        291 0.97384066587396
        293 0.974435196195006
        293 0.975029726516052
        293 0.975624256837099
        295 0.976218787158145
        295 0.976813317479191
        297 0.977407847800238
        297 0.978002378121284
        298 0.978596908442331
        298 0.979191438763377
        299 0.979785969084423
        300 0.98038049940547
        301 0.980975029726516
        303 0.981569560047562
        315 0.982164090368609
        316 0.982758620689655
        316 0.983353151010702
        321 0.983947681331748
        324 0.984542211652794
        326 0.985136741973841
        331 0.985731272294887
        336 0.986325802615933
        344 0.98692033293698
        350 0.987514863258026
        350 0.988109393579073
        365 0.988703923900119
        367 0.989298454221165
        378 0.989892984542212
        384 0.990487514863258
        390 0.991082045184304
        392 0.991676575505351
        394 0.992271105826397
        413 0.992865636147443
        420 0.99346016646849
        429 0.994054696789536
        431 0.994649227110583
        452 0.995243757431629
        478 0.995838287752675
        481 0.996432818073722
        485 0.997027348394768
        507 0.997621878715815
        508 0.998216409036861
        509 0.998810939357907
        583 0.999405469678954
    };
    \addlegendentry{Movies}
    \end{axis}
    \end{tikzpicture}
    \caption{ML }
\end{subfigure}
    \end{figure}
\end{document}  

enter image description here

  • In the case, that you have wider text width, than you can change common pgfplots settings to:
\documentclass{book}
\usepackage{geometry}   % determine page layout
\usepackage{subcaption}
\usepackage{caption}
\captionsetup[subfigure]{font=footnotesize}
\usepackage{pgfplots, pgfplotstable}
\pgfplotsset{compat=1.16}
\usetikzlibrary{positioning}

\begin{document}
    \begin{figure}[ht]
    \pgfplotsset{width=0.82\linewidth,
    scale only axis,
    axis background/.style={fill=black!20},
    axis line style={white},
    legend pos=south east,
    legend style={draw=none, fill=black!20, legend cell align=left},
    tick align=outside,
    tick pos=left,
    grid, grid style={white},
    }    

which gives:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.