1

I rely on the tikzscale package to conveniently scale all my pgfplots to the right size. However, I recently ran into the problem that this doesn't seem to work with the fillbetween library. Is there a workaround for this problem, preferably still using tikzscale?

See also: Scaling problem with fillbetween in pgfplots


MWE showing the problem:

This plot compiles fine.

\documentclass{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepgfplotslibrary{fillbetween}

\begin{document}

\begin{tikzpicture}
\begin{axis}[xmin=0,
xmax=3500,
ymin=0,
ymax=2000000000]%,

\addplot [name path=lower,color=red,dotted]
  table[row sep=crcr]{ 
200 1e7\\
1000 1e8\\
3000 1e8\\
};

\addplot [name path=upper,color=red,dotted]
  table[row sep=crcr]{ 
200 1e8\\
1000 2e8\\
3000 1e9\\
};

\addplot+[red, opacity=0.4] 
fill between[of=upper and lower];

\end{axis}
\end{tikzpicture}

\end{document}

Correct plot

However, if I use tikzscale, put the tikzpicture-environment without any changes in the file figure1.tikz and use this code, strange things happen:

\documentclass{standalone}

\usepackage{pgfplots}
\usepackage{tikzscale}
\pgfplotsset{compat=1.14}
\usepgfplotslibrary{fillbetween}

\begin{document}
\includegraphics[width=10cm]{figure1.tikz}

\end{document}

Instead of staying in the boundaries, the filled area just ignores certain points.

wrong plot

0

I was able to solve this problem by installing the current version of tikz/pgf to my local texmf.

| improve this answer | |

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.