使用装饰时,pgfplots 中的尺寸太大

使用装饰时,pgfplots 中的尺寸太大

我有一组分布不均匀的点。我发​​现这个帖子这应该能满足我的要求,但当我尝试使用它来解决我的问题时,我得到了一个Dimension too large错误,而且我最终没有得到一个图。这是我尝试编译的代码。

\documentclass[a4paper,12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[]

   \addplot [smooth,thick,color=blue, 
      postaction={
        decoration={
          markings,
          mark=between positions 0 and 1 step 0.1
               with { \fill circle[radius=2pt]; },
        },
        decorate,
      },
      domain=-3.14:3.14,
      samples=10,
   ] table{
-0.38099999230303   199406.501051229
-0.380884320871537  199365.407259867
-0.380768649440043  199324.317600021
-0.380537306577056  199242.150688477
-0.380074620851082  199077.86659333
-0.379149249399134  198749.498079625
-0.377298506495239  198093.565910485
-0.373597020687447  196784.97075711
-0.36557135114286   193963.09674876
-0.358077529123815  191348.210427579
-0.350730706145463  188804.381427219
-0.342761185238107  186068.270698234
-0.335323511856293  183537.830722232
-0.327263140545475  180822.076760121
-0.31934976827535   178184.168851384
-0.311968243530767  175750.204652269
-0.303964020857181  173141.533094867
-0.296491645709136  170736.434024905
-0.289166269601784  168408.432066772
-0.281218195565428  165917.561710808
-0.273801969054615  163627.863604111
-0.265763044614797  161185.407301121
-0.257871119215673  158829.538764559
-0.25051104134209   156671.662740037
-0.242528265539504  154376.020421481
-0.235077337262459  152277.268211106
-0.227003711056411  150053.164107717
-0.219077083891056  147922.395326773
-0.211682304251242  145983.771307456
-0.203664826682425  143937.689528338
-0.196179196639149  142081.711378427
-0.188840565636567  140314.987471693
-0.180879236704981  138459.498341918
-0.173449755298937  136787.21152484
-0.165397575963889  135041.375410089
-0.157492395669534  133396.778565128
-0.150119062900721  131926.444589982
-0.142123032202904  130403.053389279
-0.134658849030629  129049.248876948
-0.127341664899047  127787.369338335
-0.119401782838461  126492.516446894
-0.111993748303417  125355.360506171
-0.103963015839369  124201.12791175
-0.096464130900863  123197.993670554
-0.08911224500305   122285.265005996
-0.081137661176234  121375.133872323
-0.073694924874959  120601.28425675
-0.06562949064468   119845.603623385
-0.050074177616269  118633.291292811
-0.040445822681127  118045.469726907
-0.030943448397504  117587.650939803
-0.021542452386823  117254.504953564
-0.010121881877775  117010.273159621
0.010252595154182   117012.072031239
0.021025074274485   117239.632516534
0.030656412234619   117575.714892318
0.04262744688219    118167.739755309
0.050027289441464   118630.126944655
0.065540522892478   119837.750531103
0.072884216814521   120521.419511186
0.080850608665568   121343.931617968
0.088285152991073   122186.993660124
0.096342395245582   123182.308181852
0.104252638459397   124241.322769323
0.111631034147671   125301.459643262
0.119632127764949   126528.978819172
0.127101373856685   127747.039268037
0.134423620907727   129007.671170366
0.142368565887774   130448.714376932
0.149781663342279   131860.656845236
0.157817458725787   133463.025077055
0.165321406583754   135025.19802553
0.172678355401027   136616.927819083
0.180658002147305   138408.865640825
0.18810580136804    140141.04501643
0.19617629851778    142081.003239535
0.204099796626826   144047.16908768
0.21149144721033    145934.381197583
0.219505795722838   148036.261536062
0.226988296709805   150048.969014494
0.234323798656078   152067.449337248
0.242281998531355   154305.964170006
0.24970835088109    156438.687879645
0.257757401159829   158795.905613363
0.265659452397875   161154.209839522
0.273029656110379   163391.398508429
0.281022557751887   165856.725190514
0.288483611867853   168193.036471996
0.295797666943126   170514.601027521
0.303734419947403   173067.189871274
0.311139325426138   175478.54467667
0.319166928833877   178123.563510636
0.326662684716074   180620.912986346
0.334011441557577   183093.840647776
0.341982896328085   185802.417150139
0.349422503573051   188353.548229749
0.35748480874702    191142.242370126
0.365400114880297   193903.126125312
0.372783573488031   196497.983875656
0.372911955032016   196543.262962704
0.373040336576  196588.547434927
0.373297099663969   196679.132515381
0.373810625839906   196860.367083898
0.374837678191781   197223.092763236
0.376891782895531   197949.561638057
0.377020164439515   197995.010648961
0.3771485459835 198040.464890766
0.377405309071468   198131.389048049
0.377918835247406   198313.299924334
0.378945887599281   198677.370863128
0.379074269143265   198722.90299963
0.379202650687249   198768.440291362
0.379459413775218   198859.530321734
0.379972939951155   199041.77203882
0.38010132149514    199087.345285855
0.380229703039124   199132.923650649
0.380486466127093   199224.095714845
0.380614847671077   199269.689404925
0.380743229215062   199315.288194116
0.380871610759046   199360.892077767
0.38099999230303    199406.501051229
   };

  \end{axis}
\end{tikzpicture}
\end{document}

答案1

如果您删除smooth它,它将按预期工作。

\documentclass[a4paper,12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[]

   \addplot [thick,color=blue, 
      postaction={
        decoration={
          markings,
          mark=between positions 0 and 1 step 0.1
               with { \fill circle[radius=2pt]; },
        },
        decorate,
      },
      %domain=-3.14:3.14,
      %samples=10,
   ] table{
-0.38099999230303   199406.501051229
-0.380884320871537  199365.407259867
-0.380768649440043  199324.317600021
-0.380537306577056  199242.150688477
-0.380074620851082  199077.86659333
-0.379149249399134  198749.498079625
-0.377298506495239  198093.565910485
-0.373597020687447  196784.97075711
-0.36557135114286   193963.09674876
-0.358077529123815  191348.210427579
-0.350730706145463  188804.381427219
-0.342761185238107  186068.270698234
-0.335323511856293  183537.830722232
-0.327263140545475  180822.076760121
-0.31934976827535   178184.168851384
-0.311968243530767  175750.204652269
-0.303964020857181  173141.533094867
-0.296491645709136  170736.434024905
-0.289166269601784  168408.432066772
-0.281218195565428  165917.561710808
-0.273801969054615  163627.863604111
-0.265763044614797  161185.407301121
-0.257871119215673  158829.538764559
-0.25051104134209   156671.662740037
-0.242528265539504  154376.020421481
-0.235077337262459  152277.268211106
-0.227003711056411  150053.164107717
-0.219077083891056  147922.395326773
-0.211682304251242  145983.771307456
-0.203664826682425  143937.689528338
-0.196179196639149  142081.711378427
-0.188840565636567  140314.987471693
-0.180879236704981  138459.498341918
-0.173449755298937  136787.21152484
-0.165397575963889  135041.375410089
-0.157492395669534  133396.778565128
-0.150119062900721  131926.444589982
-0.142123032202904  130403.053389279
-0.134658849030629  129049.248876948
-0.127341664899047  127787.369338335
-0.119401782838461  126492.516446894
-0.111993748303417  125355.360506171
-0.103963015839369  124201.12791175
-0.096464130900863  123197.993670554
-0.08911224500305   122285.265005996
-0.081137661176234  121375.133872323
-0.073694924874959  120601.28425675
-0.06562949064468   119845.603623385
-0.050074177616269  118633.291292811
-0.040445822681127  118045.469726907
-0.030943448397504  117587.650939803
-0.021542452386823  117254.504953564
-0.010121881877775  117010.273159621
0.010252595154182   117012.072031239
0.021025074274485   117239.632516534
0.030656412234619   117575.714892318
0.04262744688219    118167.739755309
0.050027289441464   118630.126944655
0.065540522892478   119837.750531103
0.072884216814521   120521.419511186
0.080850608665568   121343.931617968
0.088285152991073   122186.993660124
0.096342395245582   123182.308181852
0.104252638459397   124241.322769323
0.111631034147671   125301.459643262
0.119632127764949   126528.978819172
0.127101373856685   127747.039268037
0.134423620907727   129007.671170366
0.142368565887774   130448.714376932
0.149781663342279   131860.656845236
0.157817458725787   133463.025077055
0.165321406583754   135025.19802553
0.172678355401027   136616.927819083
0.180658002147305   138408.865640825
0.18810580136804    140141.04501643
0.19617629851778    142081.003239535
0.204099796626826   144047.16908768
0.21149144721033    145934.381197583
0.219505795722838   148036.261536062
0.226988296709805   150048.969014494
0.234323798656078   152067.449337248
0.242281998531355   154305.964170006
0.24970835088109    156438.687879645
0.257757401159829   158795.905613363
0.265659452397875   161154.209839522
0.273029656110379   163391.398508429
0.281022557751887   165856.725190514
0.288483611867853   168193.036471996
0.295797666943126   170514.601027521
0.303734419947403   173067.189871274
0.311139325426138   175478.54467667
0.319166928833877   178123.563510636
0.326662684716074   180620.912986346
0.334011441557577   183093.840647776
0.341982896328085   185802.417150139
0.349422503573051   188353.548229749
0.35748480874702    191142.242370126
0.365400114880297   193903.126125312
0.372783573488031   196497.983875656
0.372911955032016   196543.262962704
0.373040336576  196588.547434927
0.373297099663969   196679.132515381
0.373810625839906   196860.367083898
0.374837678191781   197223.092763236
0.376891782895531   197949.561638057
0.377020164439515   197995.010648961
0.3771485459835 198040.464890766
0.377405309071468   198131.389048049
0.377918835247406   198313.299924334
0.378945887599281   198677.370863128
0.379074269143265   198722.90299963
0.379202650687249   198768.440291362
0.379459413775218   198859.530321734
0.379972939951155   199041.77203882
0.38010132149514    199087.345285855
0.380229703039124   199132.923650649
0.380486466127093   199224.095714845
0.380614847671077   199269.689404925
0.380743229215062   199315.288194116
0.380871610759046   199360.892077767
0.38099999230303    199406.501051229
   };

  \end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

如果你真的想使用平滑(几乎没有明显的区别),你可以这样做

\documentclass[a4paper,12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[]

   \addplot [smooth,thick,color=blue] table{
-0.38099999230303   199406.501051229
-0.380884320871537  199365.407259867
-0.380768649440043  199324.317600021
-0.380537306577056  199242.150688477
-0.380074620851082  199077.86659333
-0.379149249399134  198749.498079625
-0.377298506495239  198093.565910485
-0.373597020687447  196784.97075711
-0.36557135114286   193963.09674876
-0.358077529123815  191348.210427579
-0.350730706145463  188804.381427219
-0.342761185238107  186068.270698234
-0.335323511856293  183537.830722232
-0.327263140545475  180822.076760121
-0.31934976827535   178184.168851384
-0.311968243530767  175750.204652269
-0.303964020857181  173141.533094867
-0.296491645709136  170736.434024905
-0.289166269601784  168408.432066772
-0.281218195565428  165917.561710808
-0.273801969054615  163627.863604111
-0.265763044614797  161185.407301121
-0.257871119215673  158829.538764559
-0.25051104134209   156671.662740037
-0.242528265539504  154376.020421481
-0.235077337262459  152277.268211106
-0.227003711056411  150053.164107717
-0.219077083891056  147922.395326773
-0.211682304251242  145983.771307456
-0.203664826682425  143937.689528338
-0.196179196639149  142081.711378427
-0.188840565636567  140314.987471693
-0.180879236704981  138459.498341918
-0.173449755298937  136787.21152484
-0.165397575963889  135041.375410089
-0.157492395669534  133396.778565128
-0.150119062900721  131926.444589982
-0.142123032202904  130403.053389279
-0.134658849030629  129049.248876948
-0.127341664899047  127787.369338335
-0.119401782838461  126492.516446894
-0.111993748303417  125355.360506171
-0.103963015839369  124201.12791175
-0.096464130900863  123197.993670554
-0.08911224500305   122285.265005996
-0.081137661176234  121375.133872323
-0.073694924874959  120601.28425675
-0.06562949064468   119845.603623385
-0.050074177616269  118633.291292811
-0.040445822681127  118045.469726907
-0.030943448397504  117587.650939803
-0.021542452386823  117254.504953564
-0.010121881877775  117010.273159621
0.010252595154182   117012.072031239
0.021025074274485   117239.632516534
0.030656412234619   117575.714892318
0.04262744688219    118167.739755309
0.050027289441464   118630.126944655
0.065540522892478   119837.750531103
0.072884216814521   120521.419511186
0.080850608665568   121343.931617968
0.088285152991073   122186.993660124
0.096342395245582   123182.308181852
0.104252638459397   124241.322769323
0.111631034147671   125301.459643262
0.119632127764949   126528.978819172
0.127101373856685   127747.039268037
0.134423620907727   129007.671170366
0.142368565887774   130448.714376932
0.149781663342279   131860.656845236
0.157817458725787   133463.025077055
0.165321406583754   135025.19802553
0.172678355401027   136616.927819083
0.180658002147305   138408.865640825
0.18810580136804    140141.04501643
0.19617629851778    142081.003239535
0.204099796626826   144047.16908768
0.21149144721033    145934.381197583
0.219505795722838   148036.261536062
0.226988296709805   150048.969014494
0.234323798656078   152067.449337248
0.242281998531355   154305.964170006
0.24970835088109    156438.687879645
0.257757401159829   158795.905613363
0.265659452397875   161154.209839522
0.273029656110379   163391.398508429
0.281022557751887   165856.725190514
0.288483611867853   168193.036471996
0.295797666943126   170514.601027521
0.303734419947403   173067.189871274
0.311139325426138   175478.54467667
0.319166928833877   178123.563510636
0.326662684716074   180620.912986346
0.334011441557577   183093.840647776
0.341982896328085   185802.417150139
0.349422503573051   188353.548229749
0.35748480874702    191142.242370126
0.365400114880297   193903.126125312
0.372783573488031   196497.983875656
0.372911955032016   196543.262962704
0.373040336576  196588.547434927
0.373297099663969   196679.132515381
0.373810625839906   196860.367083898
0.374837678191781   197223.092763236
0.376891782895531   197949.561638057
0.377020164439515   197995.010648961
0.3771485459835 198040.464890766
0.377405309071468   198131.389048049
0.377918835247406   198313.299924334
0.378945887599281   198677.370863128
0.379074269143265   198722.90299963
0.379202650687249   198768.440291362
0.379459413775218   198859.530321734
0.379972939951155   199041.77203882
0.38010132149514    199087.345285855
0.380229703039124   199132.923650649
0.380486466127093   199224.095714845
0.380614847671077   199269.689404925
0.380743229215062   199315.288194116
0.380871610759046   199360.892077767
0.38099999230303    199406.501051229
   };
  \addplot[draw=none,
  postaction={
        decoration={
          markings,
          mark=between positions 0 and 1 step 0.1
               with { \fill[blue] circle[radius=2pt]; },
        },
        decorate,
      },] table{
-0.38099999230303   199406.501051229
-0.380884320871537  199365.407259867
-0.380768649440043  199324.317600021
-0.380537306577056  199242.150688477
-0.380074620851082  199077.86659333
-0.379149249399134  198749.498079625
-0.377298506495239  198093.565910485
-0.373597020687447  196784.97075711
-0.36557135114286   193963.09674876
-0.358077529123815  191348.210427579
-0.350730706145463  188804.381427219
-0.342761185238107  186068.270698234
-0.335323511856293  183537.830722232
-0.327263140545475  180822.076760121
-0.31934976827535   178184.168851384
-0.311968243530767  175750.204652269
-0.303964020857181  173141.533094867
-0.296491645709136  170736.434024905
-0.289166269601784  168408.432066772
-0.281218195565428  165917.561710808
-0.273801969054615  163627.863604111
-0.265763044614797  161185.407301121
-0.257871119215673  158829.538764559
-0.25051104134209   156671.662740037
-0.242528265539504  154376.020421481
-0.235077337262459  152277.268211106
-0.227003711056411  150053.164107717
-0.219077083891056  147922.395326773
-0.211682304251242  145983.771307456
-0.203664826682425  143937.689528338
-0.196179196639149  142081.711378427
-0.188840565636567  140314.987471693
-0.180879236704981  138459.498341918
-0.173449755298937  136787.21152484
-0.165397575963889  135041.375410089
-0.157492395669534  133396.778565128
-0.150119062900721  131926.444589982
-0.142123032202904  130403.053389279
-0.134658849030629  129049.248876948
-0.127341664899047  127787.369338335
-0.119401782838461  126492.516446894
-0.111993748303417  125355.360506171
-0.103963015839369  124201.12791175
-0.096464130900863  123197.993670554
-0.08911224500305   122285.265005996
-0.081137661176234  121375.133872323
-0.073694924874959  120601.28425675
-0.06562949064468   119845.603623385
-0.050074177616269  118633.291292811
-0.040445822681127  118045.469726907
-0.030943448397504  117587.650939803
-0.021542452386823  117254.504953564
-0.010121881877775  117010.273159621
0.010252595154182   117012.072031239
0.021025074274485   117239.632516534
0.030656412234619   117575.714892318
0.04262744688219    118167.739755309
0.050027289441464   118630.126944655
0.065540522892478   119837.750531103
0.072884216814521   120521.419511186
0.080850608665568   121343.931617968
0.088285152991073   122186.993660124
0.096342395245582   123182.308181852
0.104252638459397   124241.322769323
0.111631034147671   125301.459643262
0.119632127764949   126528.978819172
0.127101373856685   127747.039268037
0.134423620907727   129007.671170366
0.142368565887774   130448.714376932
0.149781663342279   131860.656845236
0.157817458725787   133463.025077055
0.165321406583754   135025.19802553
0.172678355401027   136616.927819083
0.180658002147305   138408.865640825
0.18810580136804    140141.04501643
0.19617629851778    142081.003239535
0.204099796626826   144047.16908768
0.21149144721033    145934.381197583
0.219505795722838   148036.261536062
0.226988296709805   150048.969014494
0.234323798656078   152067.449337248
0.242281998531355   154305.964170006
0.24970835088109    156438.687879645
0.257757401159829   158795.905613363
0.265659452397875   161154.209839522
0.273029656110379   163391.398508429
0.281022557751887   165856.725190514
0.288483611867853   168193.036471996
0.295797666943126   170514.601027521
0.303734419947403   173067.189871274
0.311139325426138   175478.54467667
0.319166928833877   178123.563510636
0.326662684716074   180620.912986346
0.334011441557577   183093.840647776
0.341982896328085   185802.417150139
0.349422503573051   188353.548229749
0.35748480874702    191142.242370126
0.365400114880297   193903.126125312
0.372783573488031   196497.983875656
0.372911955032016   196543.262962704
0.373040336576  196588.547434927
0.373297099663969   196679.132515381
0.373810625839906   196860.367083898
0.374837678191781   197223.092763236
0.376891782895531   197949.561638057
0.377020164439515   197995.010648961
0.3771485459835 198040.464890766
0.377405309071468   198131.389048049
0.377918835247406   198313.299924334
0.378945887599281   198677.370863128
0.379074269143265   198722.90299963
0.379202650687249   198768.440291362
0.379459413775218   198859.530321734
0.379972939951155   199041.77203882
0.38010132149514    199087.345285855
0.380229703039124   199132.923650649
0.380486466127093   199224.095714845
0.380614847671077   199269.689404925
0.380743229215062   199315.288194116
0.380871610759046   199360.892077767
0.38099999230303    199406.501051229
   };
  \end{axis}
\end{tikzpicture}
\end{document}

相关内容