![pgfplots/standalone:当通过 \includestandalone[mode=tex] 调用时,设置新层修剪 pgfplot 输出](https://linux22.com/image/380704/pgfplots%2Fstandalone%EF%BC%9A%E5%BD%93%E9%80%9A%E8%BF%87%20%5Cincludestandalone%5Bmode%3Dtex%5D%20%E8%B0%83%E7%94%A8%E6%97%B6%EF%BC%8C%E8%AE%BE%E7%BD%AE%E6%96%B0%E5%B1%82%E4%BF%AE%E5%89%AA%20pgfplot%20%E8%BE%93%E5%87%BA.png)
对于主文件
\documentclass{article}
\usepackage{pgfplots}
\usepackage[subpreambles=true]{standalone}
\pgfplotsset{compat=newest,
layers/my layer set/.define layer set={
background,main, rpim40 , rpim85 , sph,expint, exp
}{},
set layers=my layer set,
mark layer=like plot,
}
\usepgfplotslibrary{groupplots}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\begin{document}
\begin{figure}
\frame{
\includestandalone[mode=tex,width=\textwidth]{exsurfacetikz}
}
\caption{My TikZ picture}
\end{figure}
\end{document}
调用以下独立 pgfplot 使用\includestandalone[mode=tex]
结果错误地仅当我使用主文件中的新图层设置时才会进行底部修剪输出set layers=my layer set
。
% exsurfacetikz.tex
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
% view={0}{90},
% you need to add this to get the desired result
unbounded coords=jump,
colorbar horizontal
]
\addplot3 [
surf,
] table [
x=x,
y=y,
z expr={\thisrow{z} == 100 ? NaN : \thisrow{z}},
] {
x y z
3.1 1.00 21.8
3.1 0.98 19.16666667
3.1 0.96 17.83333333
3.1 0.94 16.16666667
3.1 0.92 15.5
3.1 0.90 14.83333333
3.1 0.88 14.16666667
3.1 0.86 13.5
3.1 0.84 12.83333333
3.1 0.82 12.16666667
3.1 0.80 12.16666667
3.1 0.78 11.5
3.1 0.76 100
3.1 0.74 100
3.3 1 21.83333333
3.3 0.98 20.5
3.3 0.96 18.5
3.3 0.94 16.83333333
3.3 0.92 15.5
3.3 0.9 14.83333333
3.3 0.88 14.16666667
3.3 0.86 13.5
3.3 0.84 12.83333333
3.3 0.82 12.16666667
3.3 0.8 12.16666667
3.3 0.78 11.5
3.3 0.76 11.5
3.3 0.74 11.5
};
\end{axis}
\end{tikzpicture}
\end{document}