编辑

编辑

pgfplots手册不断导致我的 Preview.app 和 Skim.app 崩溃。快速谷歌搜索后,找到了pgfplots在Sourceforge 页面上关闭错误报告和一个apple.stackexchange.com 上的相关问题,表明这是一个已知问题。它不会在每个页面上发生;它似乎更喜欢有更复杂图表的页面。虽然这在技术上不是 TeX 问题,但它只会影响 TeX 用户;根据已关闭的错误报告,这是 Apple 的错误,对此无能为力,我想检查是否有其他人遇到过这个问题并找到了解决方法——无论如何——周围足够长的时间来完成手册中的一个示例(或者我注定要截屏它?!)。


编辑

根据 Christian Feuersänger 的建议,这里有一些最小崩溃示例。另外需要注意的是,Adobe Reader(版本 9)可以处理所有这些图,但与 Skim 或 Preview 相比,它速度较慢且不稳定;您几乎可以感觉到它很难完成工作。

参数化绘图崩溃

% pgfplots manual, page 121
% parametrized plot #4
% Compiled: 2012-11-02
% This one crashes unceremoniously. 

\documentclass{standalone}
\usepackage{pgfplots}
  \pgfplotsset{width=7cm,compat=1.7}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[view={60}{30}]
    \addplot3[surf,shader=interp,z buffer=sort,
    samples=30,domain=-1:0,y domain=0:2*pi]
    ({sqrt(1-x^2) * cos(deg(y))},
    {sqrt( 1-x^2 ) * sin(deg(y))},
    x);
  \end{axis}
\end{tikzpicture}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: xetex
%%% TeX-master: t
%%% End: 

双二次块图

% pgfplots manual, page 343
% patch type, biquadratic
% Compiled: 2012-11-02
% This one renders the axes and then hangs before plotting.

\documentclass{standalone}
\usepackage{pgfplots}
  \pgfplotsset{width=7cm,compat=1.7}
  \usepgfplotslibrary{patchplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
  title={Mesh on top of patches (i): obscured}]

\addplot3[patch,patch type=biquadratic,shader=interp,
  patch refines=3]
coordinates {
 (0,0,1) (6,1,1.6) (5,5,1.3) (-1,5,0)
 (3,1,0) (6,3,0.4) (2,6,1.1) (0,3,0.9)
 (3,3.75,0.5)
};
\addplot3[patch,patch type=biquadratic,mesh,black,
  patch refines=3]
coordinates {
  (0,0,1) (6,1,1.6) (5,5,1.3) (-1,5,0)
  (3,1,0) (6,3,0.4) (2,6,1.1) (0,3,0.9)
  (3,3.75,0.5)
};
\end{axis}
\end{tikzpicture}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: xetex
%%% TeX-master: t
%%% End: 

双线性斑块图

% pgfplots manual, page 343
% patch type, biliniear
% Compiled: 2012-11-02
% Not the same as the bilinear example on the pgfplots manual because that one
% reads data from a file I don't have. 
% This one renders the axes and then hangs before plotting.

\documentclass{standalone}
\usepackage{pgfplots}
  \pgfplotsset{width=7cm,compat=1.7}
  \usepgfplotslibrary{patchplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
  title={Mesh on top of patches (i): obscured}]

\addplot3[patch,patch type=bilinear,shader=interp,
  patch refines=3]
coordinates {
 (0,0,1) (6,1,1.6) (5,5,1.3) (-1,5,0)
 (3,1,0) (6,3,0.4) (2,6,1.1) (0,3,0.9)
 (3,3.75,0.5)
};
\addplot3[patch,patch type=biquadratic,mesh,black,
  patch refines=3]
coordinates {
  (0,0,1) (6,1,1.6) (5,5,1.3) (-1,5,0)
  (3,1,0) (6,3,0.4) (2,6,1.1) (0,3,0.9)
  (3,3.75,0.5)
};
\end{axis}
\end{tikzpicture}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: xetex
%%% TeX-master: t
%%% End: 

双三次斑块图

% pgfplots manual, page 336
% patch type, bicubic
% Compiled: 2012-11-02
% This one renders differently than in the manual. Uglier.

\documentclass{standalone}
\usepackage{pgfplots}
  \pgfplotsset{width=7cm,compat=1.7}
  \usepgfplotslibrary{patchplots}

\begin{document}

% Preamble: \pgfplotsset{width=7cm,compat=1.7}
\begin{tikzpicture}
\begin{axis}[nodes near coords={(\coordindex)},
  title=Single Bicubic Quadrilateral]
\addplot3[patch,patch type=bicubic,shader=interp]
coordinates {
  (0,0,1) (1,0,0) (2,0,0) (3,0,0)
  (0,1,0) (1,1,0) (2,1,0) (3,1,0)
  (0,2,0) (1,2,0) (2,2,0) (3,2,0)
  (0,3,0) (1,3,0) (2,3,0) (3,3,0)
};
\end{axis}
\end{tikzpicture}

\end{document}

%% Switched to pdflatex engine because of this error: 
% ERROR: Package pgfplots Error: Sorry, surface shading (shader=interp) is NOT
% available for the selected driver `pgfsys-xetex.def'. I will use 'shader=flat'
% if you continue now.

%% Output is not as expected or as shown in the manual

%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: default
%%% TeX-master: t
%%% End: 

补丁图,双三次(崩溃的图)

% pgfplots manual, page 337
% patch type, bicubic
% Compiled: 2012-11-02
% This one renders axes and then hangs.

\documentclass{standalone}
\usepackage{pgfplots}
  \pgfplotsset{width=7cm,compat=1.7}
  \usepgfplotslibrary{patchplots}

\begin{document}


\begin{tikzpicture}
\begin{axis}[
    title=Two Bicubic Patches]
\addplot3[patch,patch type=bicubic,shader=interp,point
    meta=explicit]
coordinates {
    (0,0,1)[1] (1,0,0)[0] (2,0,0)[0] (3,0,0)[0]
    (0,1,0)[0] (1,1,0)[0] (2,1,0)[0] (3,1,0)[0]
    (0,2,0)[0] (1,2,0)[0] (2,2,0)[0] (3,2,0)[0]
    (0,3,0)[0] (1,3,0)[0] (2,3,0)[0] (3,3,0)[0]
    (3,0,0)[0] (4,0,0)[0] (5,0,0)[0] (6,0,0)[0.7]
    (3,1,0)[0] (4,1,.5)[1](5,1,0)[0] (6,1,0)[0]
    (3,2,0)[0] (4,2,0)[0] (5,2,0)[0] (6,2,0)[0]
    (3,3,0)[0] (4,3,0)[0] (5,3,0)[0] (6,3,0)[0.1]
  };
\end{axis}
\end{tikzpicture}

\end{document}

%% Switched to pdflatex engine because of this error: 
% ERROR: Package pgfplots Error: Sorry, surface shading (shader=interp) is NOT
% available for the selected driver `pgfsys-xetex.def'. I will use 'shader=flat'
% if you continue now.


%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: default
%%% TeX-master: t
%%% End:

斑块图,浣熊

% pgfplots manual, page 337-338
% patch type, coons
% Compiled: 2012-11-02
% This one renders differently than in the manual

\documentclass{standalone}
\usepackage{pgfplots}
  \pgfplotsset{width=7cm,compat=1.7}
  \usepgfplotslibrary{patchplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[nodes near coords={(\coordindex)},
  width=12cm,
  title=A Coons Patch]
\addplot[mark=*,patch,patch type=coons,
  shader=interp,point meta=explicit]
coordinates {
  (0,0) [0] % first corner
  (1,-1) [0] % Bezier control point between (0) and (3)
  (4,0.7) [0] % Bezier control point between (0) and (3)
%
  (3,2) [1] % second corner
  (4,3.5) [1] % Bezier control point between (3) and (6)
  (7,2) [1] % Bezier control point between (3) and (6)
%
  (7,1) [2] % third corner
  (6,0.6) [2] % Bezier control point between (6) and (9)
  (4.5,-0.5) [2] % Bezier control point between (6) and (9)
%
  (5,-2) [3] % fourth corner
  (4,-2.5) [3] % Bezier control point between (9) and (0)
  (-1,-2) [3] % Bezier control point between (9) and (0)
};
\end{axis}
\end{tikzpicture}

\end{document}

%% Switched to pdflatex engine because of this error: 
% ERROR: Package pgfplots Error: Sorry, surface shading (shader=interp) is NOT
% available for the selected driver `pgfsys-xetex.def'. I will use 'shader=flat'
% if you continue now.


%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: default
%%% TeX-master: t
%%% End:

答案1

好吧,您的崩溃转储表明阴影存在问题:(type4_read_triangle由 生成surf,shader=interp);另一个具有堆栈跟踪元素MakeCoonsMesh和(由许多与 结合的cg_shading_type6_draw高阶元素使用。patch typeshader=interp

我无法说我是否pgfplots做错了什么。考虑到它acroread没有抱怨,而且大多数其他免费查看器也支持阴影(尽管它们通常效率低下和/或质量差),我想说我们可以简单地确认这是查看器中的一个错误。毕竟,它不应该崩溃。永远不会。

也许您可以使用 Acrobat Reader 找到使用这些阴影生成的合适示例,以便生成最小崩溃示例。这对于尝试修复错误(可能是库,pdfkit因为它看起来)的查看者来说可能非常有用。

请注意,您应至少使用两个示例;最好是三个:一个使用标准surf,shader=interp图,至少一个使用高级图patch type。也许一个使用patch type=bilinear,shader=interp,一个使用patch type=bicubic,shader=interp。然后,您将拥有所有三种不同的 PDF 着色类型(4 + 5 几乎相同,6 和 7)。这可能是pdfkit图书馆人员感兴趣的地方。手册应该提供匹配的示例。

相关内容