Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The pgfplots manual consistently crashes both my Preview.app and my Skim.app. A quick google search yields a closed bug report on the pgfplots Sourceforge page and a related question on apple.stackexchange.com, showing that this is a known issue. It doesn't happen on every page; it seems to prefer pages with more elaborate plots. Though this is not technically a TeX question it will only affect TeX users; according to the closed bug report it is Apple's bug and there's not much that can be done about it, I wanted to check if anyone else has encountered this problem and figured out a way—any way—around it for long enough to work through one of the examples in the manual (or am I doomed to screen-capturing it?!).


Edit

As per Christian Feuersänger's suggestion, here are some Minimal Crashing Examples. On another note Adobe Reader (version 9) works with all of these plots, though compared to Skim or Preview, it is slow and choppy; you can almost feel it strain to get the job done.

Parametrized plot crash

% 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: 

Patch Plot, biquadratic

% 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: 

Patch plot, bilinear

% 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: 

Patch plot, bicubic

% 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: 

Patch plot, bicubic (a crashing one)

% 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:

Patch plot, coons

% 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:
share|improve this question
1  
A while ago, the previewer with TeXworks used to hang on me -- only occurred if the image occupied the full width of the page as per the current zoom. Hasn't happened since I updated to a newer TeXworks, but then I haven't worked much with figures in a while. But, have never has a problem with manual -- and I pretty much always use Preview to view them, but I am on 10.6.8. –  Peter Grill Nov 1 '12 at 0:48
1  
I have the exact same OS and Preview version as the one reported in linked question at apple.SE and I have never had it crash with the pgfplots manual. Perhaps, you could try Acrobat. –  Peter Grill Nov 1 '12 at 1:57
2  
Perhaps your the PDF is corrupted. Try re downloading it. Don't overwrite the existing file, create a new one. –  Peter Grill Nov 1 '12 at 4:21
1  
Concerning the pgfplots manual, I am aware of the fact the some special shadings cause problems with open-source viewers. This affects shader=interp for surf plots and all shadings of the patchplots library. Apparently, free viewers use bad implementations. I have implemented the shader for libpoppler and the implementation has been accepted. Perhaps Skim and preview rely on some related buggy library (pdfkit?). Can you confirm that it happens on specific pages - like those containing smooth surface plots with shadings? –  Christian Feuersänger Nov 1 '12 at 8:12
1  
Note that in case your crash dump contains specific information about "corruption" in that manual, I would really want to see and fix it. I am unaware of any such problems, but who knows. –  Christian Feuersänger Nov 1 '12 at 8:13

1 Answer 1

up vote 4 down vote accepted

well, your crash dumps indicate problems with shadings: type4_read_triangle (generated by surf,shader=interp); another one has the stack trace element MakeCoonsMesh and cg_shading_type6_draw (which is used by lots of higher-order patch types combined with shader=interp.

I cannot say if pgfplots has done something in a wrong way. Considering that acroread does not complain, and that most other free viewers also supports the shadings (although they are often inefficient and/or have bad quality), I would say that we can simply confirm that it is an error in the viewer. After all, it should not crash. Never.

Perhaps you can use acrobat reader to find a suitable example which has been generated using these shadings in order to produce a minimal crashing example. This might be very useful for the viewer guys who try to fix the bug (probably the pdfkit library as it seems).

Note that you should use at least two examples; better three: one with a standard surf,shader=interp plot and at least one with an advanced patch type. Perhaps one with patch type=bilinear,shader=interp and one with patch type=bicubic,shader=interp. Then you would have all three different PDF Shading types (4 + 5 which are almost the same and 6 and 7). This is probably what interests the pdfkit library guys. The manual should provide matching examples.

share|improve this answer
    
as you suggested, I found the crashing examples and turned them into MWE. I will edit the question to include them, though if there's another way I should go about this, I will be happy to oblige. –  Ricardo Nov 2 '12 at 13:23
    
I will also mark the question as answered, because using Acrobat Reader I can look through the examples and things don't crash. Not terribly comfortable, but definitely more convenient than the alternatives. Thanks! –  Ricardo Nov 2 '12 at 16:17
    
Thanks for collecting these examples. This leaves two more things to do: (1) to add \pdfcompresslevel=0 before \documentclass (such that people can easily inspect the pdf data) and (2) a bug report to the developers if the viewers in question. You can certainly link to this site, although that might be unnecessary if you give them the offending .pdf documents. –  Christian Feuersänger Nov 2 '12 at 20:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.