1

I have the following latex code that works in one of my machines and it does not work in my other machines (Ubuntu16 and Ubuntu14; may have different versions of latex installed). I suspect there is a pgfplot compatitblity issue. I was wondering if somebody could help me to get this solved in my Ubuntu 14 machine, as the other one is broken:

\documentclass[12pt]{article} \linespread{1.65}
\usepackage{subfigure}
\usepackage{pgfplots}
\usepackage{arrayjob}


\newcommand{\plotprh}[3] {
\subfigure[$\ell=#1$]{%
    \begin{tikzpicture}
    \begin{axis}[
        height=4.2cm, 
        width=5.5cm,
        xlabel={$k'$},
        ylabel={Percent (\%)},
        legend pos=north west,
        legend cell align=left,
        ymin=0,
        ylabel style={at={(0.09,0.5)},font=\small},
        xlabel style={at={(0.5,0.04)},font=\small},
        legend style={at={(0.42,0.06)},anchor=south west, nodes={scale=0.8, transform shape},font=\small,}
    ]
    \addplot[
        color=black,
        mark=square,
        mark size=3,
        ]
        coordinates { % Precision
        #2
        };
    \addplot[
        color=blue,
        mark=diamond,
        mark size=3,
        ]
        coordinates { % Recall
        #3
        };
        \legend{Precision, Recall}
    \end{axis}
    \end{tikzpicture}
    }
  }


\def\plotData{%
    {3}/{(1,8.627451e+01)(2,6.274510e+01)(3,0.000000e+00)(4,0.000000e+00)}/{(1,1.000000e+02)(2,1.000000e+02)(3,0.000000e+00)(4,0.000000e+00)},
    {4}/{(1,9.215686e+01)(2,7.843137e+01)(3,0.000000e+00)(4,0.000000e+00)}/{(1,1.000000e+02)(2,1.000000e+02)(3,0.000000e+00)(4,0.000000e+00)},
    {5}/{(1,9.607843e+01)(2,8.627451e+01)(3,5.686275e+01)(4,0.000000e+00)}/{(1,1.000000e+02)(2,1.000000e+02)(3,1.000000e+02)(4,0.000000e+00)},
    {6}/{(1,9.803922e+01)(2,9.019608e+01)(3,7.058824e+01)(4,0.000000e+00)}/{(1,1.000000e+02)(2,1.000000e+02)(3,1.000000e+02)(4,0.000000e+00)},
    {7}/{(1,1.000000e+02)(2,9.215686e+01)(3,7.843137e+01)(4,5.294118e+01)}/{(1,9.622642e+01)(2,1.000000e+02)(3,1.000000e+02)(4,1.000000e+02)},
    {8}/{(1,1.000000e+02)(2,9.607843e+01)(3,8.627451e+01)(4,5.882353e+01)}/{(1,9.107143e+01)(2,1.000000e+02)(3,1.000000e+02)(4,1.000000e+02)},
    {9}/{(1,1.000000e+02)(2,9.607843e+01)(3,8.823529e+01)(4,7.058824e+01)}/{(1,8.095238e+01)(2,1.000000e+02)(3,1.000000e+02)(4,1.000000e+02)},
    {10}/{(1,1.000000e+02)(2,9.803922e+01)(3,9.019608e+01)(4,7.843137e+01)}/{(1,7.391304e+01)(2,1.000000e+02)(3,1.000000e+02)(4,1.000000e+02)},
    {11}/{(1,1.000000e+02)(2,9.803922e+01)(3,9.215686e+01)(4,8.627451e+01)}/{(1,6.144578e+01)(2,1.000000e+02)(3,1.000000e+02)(4,1.000000e+02)},
    {12}/{(1,1.000000e+02)(2,1.000000e+02)(3,9.607843e+01)(4,8.823529e+01)}/{(1,5.543478e+01)(2,9.622642e+01)(3,1.000000e+02)(4,1.000000e+02)},
    {13}/{(1,1.000000e+02)(2,1.000000e+02)(3,9.607843e+01)(4,8.823529e+01)}/{(1,4.636364e+01)(2,9.622642e+01)(3,1.000000e+02)(4,1.000000e+02)},
    {14}/{(1,1.000000e+02)(2,1.000000e+02)(3,9.607843e+01)(4,9.019608e+01)}/{(1,4.146341e+01)(2,9.272727e+01)(3,1.000000e+02)(4,1.000000e+02)}}



\begin{document}


\begin{figure}[p]
    \centering
    \foreach \el/\recall/\precision in \plotData
    {%
        \plotprh{\el}{\precision}{\recall}%
    }%
    \caption{Results}
    \label{results}
\end{figure}

\end{document}

I get the following error:

! Package pgfplots Error: Sorry, I could not read the plot coordinates near '(1
,1.000000e+02)(2,1.000000e+02)(3,0.000000e+00)(4,0.000000e+00) '. Please check
for format mistakes..
See the pgfplots package documentation for explanation.
Type H <return> for immediate help.
  • Well, it works fine here at least (pgfplots 1.14 in TeX Live 2016). You can check which version of pgfplots you have by adding \pgfplotsversion in your document, which prints the version number. (Unrelated: the subfigure package is considered deprecated, the newer subcaption, or possibly subfig, is usually recommended instead.) – Torbjørn T. Aug 24 '16 at 7:50
  • @TorbjørnT. So that's probably the problem, as the currently installed version on this system is 1.9. – orezvani Aug 24 '16 at 7:56
1

Normally you should uninstall the old TeX Live version and install TeX Live 2016.

But for a quick fix, type the following commands in a terminal:

wget http://mirrors.ctan.org/install/graphics/pgf/contrib/pgfplots.tds.zip
unzip pgfplots.tds.zip -d ~/texmf
rm pgfplots.tds.zip

and your MWE will compile.

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.