如何將 tikzscale 與 pgfplots fill Between 庫一起使用

如何將 tikzscale 與 pgfplots fill Between 庫一起使用

我依靠 tikzscale 包來方便地將我的所有 pgfplots 縮放到正確的大小。然而,我最近遇到了一個問題,這似乎不適用於 fill Between 庫。這個問題有解決方法嗎,最好還是使用 tikzscale 嗎?

也可以看看:pgfplots 中 fill Between 的縮放問題


MWE 顯示問題:

這個情節編譯得很好。

\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}

正確的情節

但是,如果我使用 tikzscale,將 tikzpicture-environment 放入文件中而不進行任何更改figure1.tikz並使用此程式碼,則會發生奇怪的事情:

\documentclass{standalone}

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

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

\end{document}

填充區域不會停留在邊界內,而是忽略某些點。

錯誤的情節

答案1

我透過將目前版本的 tikz/pgf 安裝到本地 texmf 來解決這個問題。

相關內容