4

I cannot understand why figure (a) does not display the filled region, while (b) does. figure (a) must have filled region also

PGF reports the following warning:

Package pgf Warning: fill between skipped: the first input path is empty. on input line 20.

Here is my code:

\documentclass{article}

\usepackage[labelformat=simple]{subcaption}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.14} 
\usepgfplotslibrary{fillbetween} 

\begin{document}

\begin{figure}
  \centering
  \begin{subfigure}[t]{0.5\textwidth}
    \begin{tikzpicture}
     \begin{axis}[try min ticks=6]
      \addplot[blue, name path=A] table{tab1.dat};
      \addplot[red, dashed, name path=B] table{tab2.dat}; 
      \addplot[orange] fill between[of=A and B, soft clip={domain=0:10}];
     \end{axis}
    \end{tikzpicture}
   \caption{}
  \end{subfigure}%
  ~~%
  \begin{subfigure}[t]{0.5\textwidth}
   \begin{tikzpicture}[yscale=1.0, xscale=1.0]
     \begin{axis}[try min ticks=6]
       \addplot[blue, name path=A] table{tab3.dat};
       \addplot[red,dashed, name path=B] table{tab2.dat}; 
       \addplot[orange] fill between[of=A and B, soft clip={domain=0:10}];
     \end{axis}
   \end{tikzpicture}
  \caption{}
 \end{subfigure}
\end{figure}

\end{document}

The tables can be downloaded at tab1 tab2 tab3

Can anyone please help me?

3
  • tab3.dat etc. is missing -- apart from that, nice MWE :) May 10, 2017 at 21:08
  • @Dr.ManuelKuehner, why are data files missing:)? I linked them at the end. May 10, 2017 at 21:59
  • Missed that :). May 10, 2017 at 22:03

2 Answers 2

4

I have no idea why, but it seems the soft clip is sensitive to the scaling (or something). For example, if you remove the first 70 data points of tab1.dat, or set xmin=-28, it works fine.

None of those are solutions of course, but you can increase the width to 8cm. That works fine here at least.

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=8cm,compat=1.14} %% <-- 8cm here
\usepgfplotslibrary{fillbetween} 

\begin{document}

    \begin{tikzpicture}
     \begin{axis}[try min ticks=6]
      \addplot[blue, name path=A] table{tab1.dat};
      \addplot[red, dashed, name path=B] table{tab2.dat}; 
      \addplot[orange] fill between[of=A and B, soft clip={domain=0:10}];
     \end{axis}
    \end{tikzpicture}
   \begin{tikzpicture}[yscale=1.0, xscale=1.0]
     \begin{axis}[try min ticks=6]
       \addplot[blue, name path=A] table{tab3.dat};
       \addplot[red,dashed, name path=B] table{tab2.dat}; 
       \addplot[orange] fill between[of=A and B, soft clip={domain=0:10}];
     \end{axis}
   \end{tikzpicture}
\end{document}
3
3

The bug was fixed in the just released PGFPlots v1.16.
Thus, your MWE now works as expected.

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.