1

enter image description here

I wanted my fill-in to go over and under the blue line. But i don't want the fill-in to go past the x axis to the other side (see image) I want no fill-in between there. Are there any solutions?

\documentclass[12pt]{report}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\usepgfplotslibrary{fillbetween}

\begin{document}
\begin{filecontents*}{name.txt}
Station ,   M3-1.4CM+1.7CV  ,   V2-1.4CM+1.7CV  ,   M3-CM   ,   V2-CM   ,   M3-CV   ,   V2-CV   ,   Progresiva  ,   +Phi Mn ,   -Phi Mn ,   Phivn   ,   Phivn
0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.12    ,   -3.20   ,   54.10   ,   -1.60   ,   27.00   ,   -0.60   ,   9.60    ,   0.50    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.24    ,   -13.00  ,   108.20  ,   -6.50   ,   54.00   ,   -2.30   ,   19.20   ,   0.75    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.36    ,   -29.20  ,   162.40  ,   -14.60  ,   81.00   ,   -5.20   ,   28.80   ,   1.00    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.48    ,   -52.00  ,   216.50  ,   -25.90  ,   108.00  ,   -9.20   ,   38.40   ,   1.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.60    ,   -81.20  ,   270.60  ,   -40.50  ,   135.00  ,   -14.40  ,   48.00   ,   1.50    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.60    ,   -81.20  ,   -767.70 ,   -40.50  ,   -383.00 ,   -14.40  ,   -136.20 ,   1.75    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.72    ,   9.30    ,   -712.60 ,   4.60    ,   -355.50 ,   1.60    ,   -126.40 ,   2.00    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.84    ,   93.00   ,   -657.50 ,   46.40   ,   -328.00 ,   16.50   ,   -116.60 ,   2.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
0.97    ,   170.00  ,   -602.40 ,   84.80   ,   -300.50 ,   30.20   ,   -106.80 ,   2.50    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.09    ,   240.30  ,   -547.20 ,   119.90  ,   -273.00 ,   42.60   ,   -97.10  ,   2.75    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.21    ,   303.80  ,   -492.10 ,   151.60  ,   -245.50 ,   53.90   ,   -87.30  ,   3.00    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.33    ,   360.60  ,   -437.00 ,   179.90  ,   -218.00 ,   64.00   ,   -77.50  ,   3.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.46    ,   410.60  ,   -381.90 ,   204.80  ,   -190.50 ,   72.80   ,   -67.70  ,   3.50    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.58    ,   453.90  ,   -326.80 ,   226.40  ,   -163.00 ,   80.50   ,   -58.00  ,   3.75    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.70    ,   490.50  ,   -271.60 ,   244.70  ,   -135.50 ,   87.00   ,   -48.20  ,   4.00    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.82    ,   520.30  ,   -216.50 ,   259.60  ,   -108.00 ,   92.30   ,   -38.40  ,   4.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.94    ,   543.40  ,   -161.40 ,   271.10  ,   -80.50  ,   96.40   ,   -28.60  ,   4.50    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.07    ,   559.80  ,   -106.30 ,   279.30  ,   -53.00  ,   99.30   ,   -18.80  ,   4.75    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.19    ,   569.40  ,   -51.10  ,   284.10  ,   -25.50  ,   101.00  ,   -9.10   ,   5.00    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.31    ,   572.30  ,   4.00    ,   285.50  ,   2.00    ,   101.50  ,   0.70    ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.43    ,   568.40  ,   59.10   ,   283.60  ,   29.50   ,   100.80  ,   10.50   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.56    ,   557.80  ,   114.20  ,   278.30  ,   57.00   ,   98.90   ,   20.30   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.68    ,   540.50  ,   169.30  ,   269.60  ,   84.50   ,   95.90   ,   30.00   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.80    ,   516.40  ,   224.50  ,   257.60  ,   112.00  ,   91.60   ,   39.80   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.92    ,   485.60  ,   279.60  ,   242.30  ,   139.50  ,   86.10   ,   49.60   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
3.04    ,   448.10  ,   334.70  ,   223.50  ,   167.00  ,   79.50   ,   59.40   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
3.17    ,   403.80  ,   389.80  ,   201.40  ,   194.50  ,   71.60   ,   69.20   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.29    ,   352.80  ,   445.00  ,   176.00  ,   222.00  ,   62.60   ,   78.90   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.41    ,   295.00  ,   500.10  ,   147.20  ,   249.50  ,   52.30   ,   88.70   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.53    ,   230.50  ,   555.20  ,   115.00  ,   277.00  ,   40.90   ,   98.50   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.66    ,   159.30  ,   610.30  ,   79.50   ,   304.50  ,   28.30   ,   108.30  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.78    ,   81.30   ,   665.40  ,   40.60   ,   332.00  ,   14.40   ,   118.00  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
3.90    ,   -3.40   ,   720.60  ,   -1.70   ,   359.50  ,   -0.60   ,   127.80  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.02    ,   -94.80  ,   775.70  ,   -47.30  ,   387.00  ,   -16.80  ,   137.60  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.14    ,   -193.00 ,   830.80  ,   -96.30  ,   414.50  ,   -34.20  ,   147.40  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.27    ,   -297.90 ,   885.90  ,   -148.60 ,   442.00  ,   -52.80  ,   157.20  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.39    ,   -409.50 ,   941.10  ,   -204.30 ,   469.50  ,   -72.60  ,   166.90  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.51    ,   -527.90 ,   996.20  ,   -263.40 ,   497.00  ,   -93.60  ,   176.70  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.63    ,   -653.00 ,   1051.30 ,   -325.80 ,   524.50  ,   -115.80 ,   186.50  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.76    ,   -784.90 ,   1106.40 ,   -391.60 ,   552.00  ,   -139.20 ,   196.30  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.88    ,   -923.50 ,   1161.50 ,   -460.70 ,   579.50  ,   -163.80 ,   206.00  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.00    ,   -1068.80    ,   1216.70 ,   -533.20 ,   607.00  ,   -189.60 ,   215.80  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.00    ,   -1068.80    ,   -1235.10    ,   -533.20 ,   -616.20 ,   -189.60 ,   -219.10 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.12    ,   -921.20 ,   -1180.00    ,   -459.60 ,   -588.70 ,   -163.40 ,   -209.30 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.24    ,   -780.40 ,   -1124.90    ,   -389.30 ,   -561.20 ,   -138.40 ,   -199.50 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.37    ,   -646.30 ,   -1069.80    ,   -322.40 ,   -533.70 ,   -114.60 ,   -189.80 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.49    ,   -518.90 ,   -1014.60    ,   -258.90 ,   -506.20 ,   -92.00  ,   -180.00 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.61    ,   -398.30 ,   -959.50 ,   -198.70 ,   -478.70 ,   -70.60  ,   -170.20 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.73    ,   -284.40 ,   -904.40 ,   -141.90 ,   -451.20 ,   -50.40  ,   -160.40 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
5.86    ,   -177.20 ,   -849.30 ,   -88.40  ,   -423.70 ,   -31.40  ,   -150.60 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
5.98    ,   -76.80  ,   -794.10 ,   -38.30  ,   -396.20 ,   -13.60  ,   -140.90 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
6.10    ,   16.90   ,   -739.00 ,   8.40    ,   -368.70 ,   3.00    ,   -131.10 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
6.22    ,   103.90  ,   -683.90 ,   51.80   ,   -341.20 ,   18.40   ,   -121.30 ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.34    ,   184.10  ,   -628.80 ,   91.90   ,   -313.70 ,   32.70   ,   -111.50 ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.47    ,   257.60  ,   -573.70 ,   128.50  ,   -286.20 ,   45.70   ,   -101.80 ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.59    ,   324.30  ,   -518.50 ,   161.80  ,   -258.70 ,   57.50   ,   -92.00  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.71    ,   384.30  ,   -463.40 ,   191.70  ,   -231.20 ,   68.20   ,   -82.20  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.83    ,   437.60  ,   -408.30 ,   218.30  ,   -203.70 ,   77.60   ,   -72.40  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
6.96    ,   484.10  ,   -353.20 ,   241.50  ,   -176.20 ,   85.90   ,   -62.60  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.08    ,   523.90  ,   -298.00 ,   261.40  ,   -148.70 ,   92.90   ,   -52.90  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.20    ,   557.00  ,   -242.90 ,   277.90  ,   -121.20 ,   98.80   ,   -43.10  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.32    ,   583.30  ,   -187.80 ,   291.00  ,   -93.70  ,   103.50  ,   -33.30  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.44    ,   602.90  ,   -132.70 ,   300.80  ,   -66.20  ,   106.90  ,   -23.50  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.57    ,   615.80  ,   -77.60  ,   307.20  ,   -38.70  ,   109.20  ,   -13.80  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.69    ,   621.90  ,   -22.40  ,   310.20  ,   -11.20  ,   110.30  ,   -4.00   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.81    ,   621.20  ,   32.70   ,   309.90  ,   16.30   ,   110.20  ,   5.80    ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.93    ,   613.90  ,   87.80   ,   306.30  ,   43.80   ,   108.90  ,   15.60   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.06    ,   599.80  ,   142.90  ,   299.20  ,   71.30   ,   106.40  ,   25.40   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.18    ,   578.90  ,   198.10  ,   288.80  ,   98.80   ,   102.70  ,   35.10   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.30    ,   551.40  ,   253.20  ,   275.10  ,   126.30  ,   97.80   ,   44.90   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.42    ,   517.00  ,   308.30  ,   257.90  ,   153.80  ,   91.70   ,   54.70   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.54    ,   476.00  ,   363.40  ,   237.50  ,   181.30  ,   84.40   ,   64.50   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.67    ,   428.20  ,   418.50  ,   213.60  ,   208.80  ,   76.00   ,   74.20   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.79    ,   373.70  ,   473.70  ,   186.40  ,   236.30  ,   66.30   ,   84.00   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
8.91    ,   312.40  ,   528.80  ,   155.90  ,   263.80  ,   55.40   ,   93.80   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.03    ,   244.40  ,   583.90  ,   121.90  ,   291.30  ,   43.40   ,   103.60  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.16    ,   169.70  ,   639.00  ,   84.70   ,   318.80  ,   30.10   ,   113.40  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.28    ,   88.20   ,   694.20  ,   44.00   ,   346.30  ,   15.60   ,   123.10  ,   6.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.40    ,   0.00    ,   749.30  ,   0.00    ,   373.80  ,   0.00    ,   132.90  ,   7.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220

\end{filecontents*}
  \begin{figure}    
    \begin{tikzpicture} 
    \begin{axis}    [                               
            axis x line=center,
            width=.90\textwidth,
            height=0.60\textwidth]                  
            \addplot[name path=U,color=blue]table[mark=none,x index=0,y index=2,col sep=comma]{name.txt};
            \addplot[name path=P,color=black]table[mark=none,x index=0,y index=10,col sep=comma]{name.txt};
            \addplot[red, opacity=0.3] fill between[of=P and U];
        \end{axis}  
        \end{tikzpicture}                                   
\end{figure}                                
\end{document}
4
  • Please, edit your question and make your code a proper MWE (tex.meta.stackexchange.com/questions/228/…).
    – Bibi
    Commented Sep 5, 2023 at 18:50
  • @Bibi hello, i edited my code as you asked.
    – user303626
    Commented Sep 5, 2023 at 19:22
  • Ok, but your MWE does not compile, since the file name.txt is needed. Please add it (preferably as a part of the MWE using filecontents -- see the previous link).
    – Bibi
    Commented Sep 6, 2023 at 7:39
  • Thank you for your input, i just added it. @Bibi
    – user303626
    Commented Sep 6, 2023 at 18:42

1 Answer 1

2

What you are looking for should be simple with soft clipping (see section 5.7 (Fill between) of the current PGFPLOTS manual), but for some reason it does not work as I expected.

Nevertheless, you will find below a quick solution using a second fill to paint in white the areas below y=0.

I also changed \pgfplotsset{compat=1.3} to \pgfplotsset{compat=newest}, since you should use the current version (if you really do have compatibility issues and must stick with v1.3, I guess you must change the coordinates (x,y) to (axis cs:x,y).

Finally, I added axis on top so that the fillings do not mask the axes.

enter image description here

\documentclass[12pt]{report}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest} % Changed (for default axis cs since v1.11, and because v1.3 is veeeery old)
\usepgfplotslibrary{fillbetween}

\begin{document}
\begin{filecontents*}{name.txt}
Station ,   M3-1.4CM+1.7CV  ,   V2-1.4CM+1.7CV  ,   M3-CM   ,   V2-CM   ,   M3-CV   ,   V2-CV   ,   Progresiva  ,   +Phi Mn ,   -Phi Mn ,   Phivn   ,   Phivn
0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.00    ,   0.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.12    ,   -3.20   ,   54.10   ,   -1.60   ,   27.00   ,   -0.60   ,   9.60    ,   0.50    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.24    ,   -13.00  ,   108.20  ,   -6.50   ,   54.00   ,   -2.30   ,   19.20   ,   0.75    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.36    ,   -29.20  ,   162.40  ,   -14.60  ,   81.00   ,   -5.20   ,   28.80   ,   1.00    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.48    ,   -52.00  ,   216.50  ,   -25.90  ,   108.00  ,   -9.20   ,   38.40   ,   1.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.60    ,   -81.20  ,   270.60  ,   -40.50  ,   135.00  ,   -14.40  ,   48.00   ,   1.50    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.60    ,   -81.20  ,   -767.70 ,   -40.50  ,   -383.00 ,   -14.40  ,   -136.20 ,   1.75    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.72    ,   9.30    ,   -712.60 ,   4.60    ,   -355.50 ,   1.60    ,   -126.40 ,   2.00    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
0.84    ,   93.00   ,   -657.50 ,   46.40   ,   -328.00 ,   16.50   ,   -116.60 ,   2.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
0.97    ,   170.00  ,   -602.40 ,   84.80   ,   -300.50 ,   30.20   ,   -106.80 ,   2.50    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.09    ,   240.30  ,   -547.20 ,   119.90  ,   -273.00 ,   42.60   ,   -97.10  ,   2.75    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.21    ,   303.80  ,   -492.10 ,   151.60  ,   -245.50 ,   53.90   ,   -87.30  ,   3.00    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.33    ,   360.60  ,   -437.00 ,   179.90  ,   -218.00 ,   64.00   ,   -77.50  ,   3.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
1.46    ,   410.60  ,   -381.90 ,   204.80  ,   -190.50 ,   72.80   ,   -67.70  ,   3.50    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.58    ,   453.90  ,   -326.80 ,   226.40  ,   -163.00 ,   80.50   ,   -58.00  ,   3.75    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.70    ,   490.50  ,   -271.60 ,   244.70  ,   -135.50 ,   87.00   ,   -48.20  ,   4.00    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.82    ,   520.30  ,   -216.50 ,   259.60  ,   -108.00 ,   92.30   ,   -38.40  ,   4.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
1.94    ,   543.40  ,   -161.40 ,   271.10  ,   -80.50  ,   96.40   ,   -28.60  ,   4.50    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.07    ,   559.80  ,   -106.30 ,   279.30  ,   -53.00  ,   99.30   ,   -18.80  ,   4.75    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.19    ,   569.40  ,   -51.10  ,   284.10  ,   -25.50  ,   101.00  ,   -9.10   ,   5.00    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.31    ,   572.30  ,   4.00    ,   285.50  ,   2.00    ,   101.50  ,   0.70    ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.43    ,   568.40  ,   59.10   ,   283.60  ,   29.50   ,   100.80  ,   10.50   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.56    ,   557.80  ,   114.20  ,   278.30  ,   57.00   ,   98.90   ,   20.30   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.68    ,   540.50  ,   169.30  ,   269.60  ,   84.50   ,   95.90   ,   30.00   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.80    ,   516.40  ,   224.50  ,   257.60  ,   112.00  ,   91.60   ,   39.80   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
2.92    ,   485.60  ,   279.60  ,   242.30  ,   139.50  ,   86.10   ,   49.60   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
3.04    ,   448.10  ,   334.70  ,   223.50  ,   167.00  ,   79.50   ,   59.40   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
3.17    ,   403.80  ,   389.80  ,   201.40  ,   194.50  ,   71.60   ,   69.20   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.29    ,   352.80  ,   445.00  ,   176.00  ,   222.00  ,   62.60   ,   78.90   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.41    ,   295.00  ,   500.10  ,   147.20  ,   249.50  ,   52.30   ,   88.70   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.53    ,   230.50  ,   555.20  ,   115.00  ,   277.00  ,   40.90   ,   98.50   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.66    ,   159.30  ,   610.30  ,   79.50   ,   304.50  ,   28.30   ,   108.30  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
3.78    ,   81.30   ,   665.40  ,   40.60   ,   332.00  ,   14.40   ,   118.00  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
3.90    ,   -3.40   ,   720.60  ,   -1.70   ,   359.50  ,   -0.60   ,   127.80  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.02    ,   -94.80  ,   775.70  ,   -47.30  ,   387.00  ,   -16.80  ,   137.60  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.14    ,   -193.00 ,   830.80  ,   -96.30  ,   414.50  ,   -34.20  ,   147.40  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.27    ,   -297.90 ,   885.90  ,   -148.60 ,   442.00  ,   -52.80  ,   157.20  ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
4.39    ,   -409.50 ,   941.10  ,   -204.30 ,   469.50  ,   -72.60  ,   166.90  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.51    ,   -527.90 ,   996.20  ,   -263.40 ,   497.00  ,   -93.60  ,   176.70  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.63    ,   -653.00 ,   1051.30 ,   -325.80 ,   524.50  ,   -115.80 ,   186.50  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.76    ,   -784.90 ,   1106.40 ,   -391.60 ,   552.00  ,   -139.20 ,   196.30  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
4.88    ,   -923.50 ,   1161.50 ,   -460.70 ,   579.50  ,   -163.80 ,   206.00  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.00    ,   -1068.80    ,   1216.70 ,   -533.20 ,   607.00  ,   -189.60 ,   215.80  ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.00    ,   -1068.80    ,   -1235.10    ,   -533.20 ,   -616.20 ,   -189.60 ,   -219.10 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.12    ,   -921.20 ,   -1180.00    ,   -459.60 ,   -588.70 ,   -163.40 ,   -209.30 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.24    ,   -780.40 ,   -1124.90    ,   -389.30 ,   -561.20 ,   -138.40 ,   -199.50 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.37    ,   -646.30 ,   -1069.80    ,   -322.40 ,   -533.70 ,   -114.60 ,   -189.80 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.49    ,   -518.90 ,   -1014.60    ,   -258.90 ,   -506.20 ,   -92.00  ,   -180.00 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.61    ,   -398.30 ,   -959.50 ,   -198.70 ,   -478.70 ,   -70.60  ,   -170.20 ,   5.25    ,   450.64  ,   -1107.32    ,   1220.00 ,   -1220
5.73    ,   -284.40 ,   -904.40 ,   -141.90 ,   -451.20 ,   -50.40  ,   -160.40 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
5.86    ,   -177.20 ,   -849.30 ,   -88.40  ,   -423.70 ,   -31.40  ,   -150.60 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
5.98    ,   -76.80  ,   -794.10 ,   -38.30  ,   -396.20 ,   -13.60  ,   -140.90 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
6.10    ,   16.90   ,   -739.00 ,   8.40    ,   -368.70 ,   3.00    ,   -131.10 ,   5.25    ,   450.64  ,   -433.83 ,   1220.00 ,   -1220
6.22    ,   103.90  ,   -683.90 ,   51.80   ,   -341.20 ,   18.40   ,   -121.30 ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.34    ,   184.10  ,   -628.80 ,   91.90   ,   -313.70 ,   32.70   ,   -111.50 ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.47    ,   257.60  ,   -573.70 ,   128.50  ,   -286.20 ,   45.70   ,   -101.80 ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.59    ,   324.30  ,   -518.50 ,   161.80  ,   -258.70 ,   57.50   ,   -92.00  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.71    ,   384.30  ,   -463.40 ,   191.70  ,   -231.20 ,   68.20   ,   -82.20  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
6.83    ,   437.60  ,   -408.30 ,   218.30  ,   -203.70 ,   77.60   ,   -72.40  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
6.96    ,   484.10  ,   -353.20 ,   241.50  ,   -176.20 ,   85.90   ,   -62.60  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.08    ,   523.90  ,   -298.00 ,   261.40  ,   -148.70 ,   92.90   ,   -52.90  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.20    ,   557.00  ,   -242.90 ,   277.90  ,   -121.20 ,   98.80   ,   -43.10  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.32    ,   583.30  ,   -187.80 ,   291.00  ,   -93.70  ,   103.50  ,   -33.30  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.44    ,   602.90  ,   -132.70 ,   300.80  ,   -66.20  ,   106.90  ,   -23.50  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.57    ,   615.80  ,   -77.60  ,   307.20  ,   -38.70  ,   109.20  ,   -13.80  ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.69    ,   621.90  ,   -22.40  ,   310.20  ,   -11.20  ,   110.30  ,   -4.00   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.81    ,   621.20  ,   32.70   ,   309.90  ,   16.30   ,   110.20  ,   5.80    ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
7.93    ,   613.90  ,   87.80   ,   306.30  ,   43.80   ,   108.90  ,   15.60   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.06    ,   599.80  ,   142.90  ,   299.20  ,   71.30   ,   106.40  ,   25.40   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.18    ,   578.90  ,   198.10  ,   288.80  ,   98.80   ,   102.70  ,   35.10   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.30    ,   551.40  ,   253.20  ,   275.10  ,   126.30  ,   97.80   ,   44.90   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.42    ,   517.00  ,   308.30  ,   257.90  ,   153.80  ,   91.70   ,   54.70   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.54    ,   476.00  ,   363.40  ,   237.50  ,   181.30  ,   84.40   ,   64.50   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.67    ,   428.20  ,   418.50  ,   213.60  ,   208.80  ,   76.00   ,   74.20   ,   5.25    ,   1240.73 ,   0.00    ,   1220.00 ,   -1220
8.79    ,   373.70  ,   473.70  ,   186.40  ,   236.30  ,   66.30   ,   84.00   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
8.91    ,   312.40  ,   528.80  ,   155.90  ,   263.80  ,   55.40   ,   93.80   ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.03    ,   244.40  ,   583.90  ,   121.90  ,   291.30  ,   43.40   ,   103.60  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.16    ,   169.70  ,   639.00  ,   84.70   ,   318.80  ,   30.10   ,   113.40  ,   5.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.28    ,   88.20   ,   694.20  ,   44.00   ,   346.30  ,   15.60   ,   123.10  ,   6.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
9.40    ,   0.00    ,   749.30  ,   0.00    ,   373.80  ,   0.00    ,   132.90  ,   7.25    ,   450.64  ,   0.00    ,   1220.00 ,   -1220
\end{filecontents*}
  \begin{figure}    
    \begin{tikzpicture} 
    \begin{axis}[                               
       axis x line=center,
       axis on top, % So that filling does not mess with the axes
       width=.90\textwidth,
       height=0.60\textwidth
       ]
       \addplot[name path=U,color=blue]table[mark=none,x index=0,y index=2,col sep=comma]{name.txt};
       \addplot[name path=P,color=black]table[mark=none,x index=0,y index=10,col sep=comma]{name.txt};
       \path[name path=xaxis](\pgfkeysvalueof{/pgfplots/xmin},0) -- (\pgfkeysvalueof{/pgfplots/xmax},0);
       \addplot[red, opacity=0.3] fill between[
          of=P and U,
          % soft clip={domain y=0:1220}, % Should be working?
       ];
       \addplot[white] fill between[
          of=xaxis and U,
       ];
   \end{axis}  
   \end{tikzpicture}                                   
\end{figure}                                
\end{document}
3
  • Thank you so much Bibi
    – user303626
    Commented Sep 14, 2023 at 3:03
  • The usual way to thank someone is to accept the answer ;-) (stackoverflow.com/help/…)
    – Bibi
    Commented Sep 14, 2023 at 11:43
  • I wasnt aware i had to put the check. Im sorry, thanks again :D
    – user303626
    Commented Sep 19, 2023 at 3:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .