3

I'm very new to using pgfplots, so maybe I'm just being impatient...

Here's the first five lines of my data file, plusMethods.csv. In total, the data file has 58 lines.

$\lambda_{dep}$,PlusCost,PlusFTE,HoldAll,Random
0.02,8.57043,8.7743216,14.6061558,6.785214
0.025,8.7006858,8.5058498,14.9181568,6.7895608
0.03,8.8933298,8.2800796,14.4981258,6.7568732
0.035,8.5948352,8.697557,14.7440514,6.7245296

Here's the relevant portion of my document

\documentclass{article}

\usepackage{caption}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
    \begin{tikzpicture}
        \begin{axis}[
                xlabel = Departure Rate,
                ylabel = Avg Portfolio Value]
            \addplot table[col sep=comma, y=PlusCost, x=$\lambda_{dep}$]{plusMethods.csv};
            \addlegendentry{+Cost}
        \end{axis}
    \end{tikzpicture}
    \caption{Performance of Triage+ Methods}
    \label{PlusMethds}
\end{figure}

\end{document}

When I build this in TeXnicCenter, it just hangs up...no errors, the green progress bar in the system tray keeps moving, the CPU fan spins up...but I've waited 15+ minutes and nothing.

Any ideas what I'm doing wrong? I can't imagine this is that complex a plot to build. Before it's all said and done I need to add three more series to this chart, and then produce four more charts just like this throughout the document...

  • Thanks! That did it...but why did the example here (tex.stackexchange.com/questions/121750/…) work? – jerH Apr 5 '15 at 18:13
  • pgfplotstable understands TeX headers up to a point but you have greek symbols, the link has only latin characters. Change those to something lambda or beta and they won't work either. – percusse Apr 5 '15 at 20:09
4

I haven't done the surgery for which exact reason it hangs but the culprit is using \mathchars in the the header of the table. A very rough explanation is that pgfplots' internal naming mechanism uses the header entry of the column as the internal column name macro. So let's say mycolumn is the header entry and with a sophisticated naming scheme, internally what happens is

\csname <internal pgfplots column name macro prefix> <mycolumn> \endcsname 

type of machinery gets invoked.

Even under normal circumstances \mathchars can not be handled but here you also provide yet another spectacular breaking point for TeX which are the math mode $ chars, for example,

\documentclass{article}
\begin{document}
\csname $\lambda$ \endcsname
\end{document}

already gives an error in the nonstop mode it prints one dollar sign and the \lambda. Internally this probably opens the math mode and breaks everything that follows in the wrong context.

The simplest remedy for it is to remove any TeX specific input in the table entries and use the column name for typesetting. For plotting just use standard names.

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.