5

I have a rather complicated pgfplots graph mixing const plot with ybar stacked and it doesn't like the data sets I am importing due to coordinate mismatch.

However the graphs are correct and exactly what I need.

How can I either:

  • increase the nonstop error limit of MikTeX?
  • tell LaTeX to ignore this error?
  • eliminate this error from the code below?

(I have already logged a request to change the error to a warning with Christian.)

Here follows a light example approximating my requirements, it also throws three typical errors:

    \documentclass[tikz,english]{article}
    \usepackage{pgfplots}
    \pgfplotsset{small, width=15cm, height=6cm,compat=1.7}

    \begin{document}
    \begin{tikzpicture}
    \begin{axis}[ybar stacked]
    \addlegendimage{line legend,thick,legend image code/.code={
      \draw[#1] (0cm,0cm) --  (0.4cm,0cm);}};
    \addlegendentry{target};
    \addlegendimage{draw=black, fill=yellow}
    \addlegendentry{S1};
    \addlegendimage{draw=black, fill=red}
    \addlegendentry{S2};

    \addplot[const plot, thick] coordinates {
    (1,1.8559703)
    (2,2.8559703)
    (3,3.5301677)
    (4,4.3050655)
    (5,4.3050655)
    };
    \addplot[const plot, draw=none, forget plot] coordinates {
    (1,-1.8559703)
    (2,-2.8559703)
    (3,-3.5301677)
    (4,-4.3050655)
    (5,-4.3050655)};
    \addplot [draw=black, fill=yellow] coordinates {
    (1.5,2.8559703)
    (2.5,2.8559703)
    (3.5,2.5301677)
    (4.5,1.3050655)};
    \addplot[draw=black, fill=red] coordinates {
    (1.5,1.8559703)
    (2.5,2.8559703)
    (3.5,2.5301677)
    (4.5,2.3050655)};
    \legend{target, s1,s2};

    \end{axis}
    \end{tikzpicture}
    \end{document}
  • 3
    I have just seen your private email and I realize that you are referring to the error "Sorry, pgfplots expects stacked plots to have exactly the same number of coordinates". I suppose that you should create a minimal working example and post it here. This would allow others to find precise answers. – Christian Feuersänger May 20 '13 at 8:43
  • 3
    I will take a note on the todo list of pgfplots which would allow you to selectively overwrite this particular exception (it is currently impossible for this specific error). – Christian Feuersänger May 20 '13 at 8:44
1

I suppose you have used \pgfplotstableread and a row with either too many or too few columns.

In this case, you can suppress the error by overwriting the exception code.

In your case, it is an "unsupported operation" which can be overwritten as follows:

\documentclass[a4paper]{article}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
    \begin{axis}
    \pgfkeys{
        /pgfplots/exception/unsupported operation/.code={},
    }
    \pgfplotstableread{
    x y z
    1 1 1
    2 2 2
    3 3 3 3
    3 3
    }\loadedtable

    \addplot table {\loadedtable};
    \end{axis}
\end{tikzpicture}
\end{document}

It seems as if this exception type is used for too many exceptional cases while typesetting tables as well. I will correct that eventually.

For now, you should use this key with care: disabling errors can produce unanticipated side effects if pgfplots does not recover as gracefully as one wants to. "Care" means: try to restrict its application to a small context, do not overwrite it globally. In particular, do not disable it in the context of \pgfplotstabletypeset. This remark applies to pgfplots 1.8 .

  • I have proposed to undelete this post since it seems better to have an authoritative yet understandably partial answer rather than having it unanswered – percusse Mar 17 '14 at 22:19

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.