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.

I'm trying to create a simple plot using pgfplots. I have a problem though that drives me crazy. I'm working on a debian installation and had installed the tex-live version from the repositories. The code below was giving me the following error

! Package pgfkeys Error: I do not know the key '/tikz/nodes near coords' and I am going to ignore it. Perhaps you misspelled it.

I though that the package was outdated and since there was no way to update it otherwise i removed the repo version of tex-live and install the one from their website (version 2011). I'm still getting the same error message though. I have to mention that the same code compiles correctly in my windows installation. Any idea why this might happen?

Code:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{caption}
\usepackage{pgfplots}

\pagestyle{fancy}
\chead{\footnotesize {header title} }
\cfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}

\title{my title}
\author{me}


\begin{document}
\renewcommand{\labelenumi}{[\arabic{enumi}]}
\fontsize{11}{12}
\selectfont

\begin{center}
\begin{tikzpicture}
  \begin{axis}
  [
    ybar,
    bar width = 1cm,
    xmin=1, xmax=1,
    xticklabels={,,},
    enlargelimits=0.15,
    xlabel={OpenCL implementation},
    ylabel={time (sec)},
    xtick=data,
    nodes near coords
  ]   
    \addplot coordinates {(1, 24.0)}; \addlegendentry{Version 1}
    \addplot coordinates {(1, 14.5)}; \addlegendentry{Version 2}
    \addplot coordinates {(1, 10.0)}; \addlegendentry{Version 3}
    \addplot coordinates {(1,  9.6)}; \addlegendentry{Version 4}
  \end{axis}
\end{tikzpicture}
\captionof{figure}{Figure caption}
\label{fig:example_caption}
\end{center}

\end{document}
share|improve this question

closed as too localized by Jake, cmhughes, Stefan Kottwitz May 3 '12 at 11:01

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I'm pretty sure you have an outdated version of PGFplots. Can you add \listfiles to your preamble and check near the end of the .log file for your version number? –  Jake May 2 '12 at 18:41
1  
You have a typo \addledendentry should be \addlegendentry. –  Peter Grill May 2 '12 at 18:43
    
I changes the typo but the problem is still there. I will also correct in the question. as for the version I believe you mean the following if I got it correct. (/usr/share/texmf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryplotm arks.code.tex File: tikzlibraryplotmarks.code.tex 2008/01/09 v2.00 (rcs-revision 1.1) (/usr/share/texmf/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex File: pgflibraryplotmarks.code.tex 2007/03/09 v2.00 (rcs-revision 1.5) ))) –  gkaran89 May 2 '12 at 18:51
2  
@gkaran89: Check in "Options / Configure TeXmaker" whether it's configured to run pdflatex from the wrong directory. –  Jake May 2 '12 at 19:11
2  
sounds like you've got two texlives installed and TeXmaker is pointing to the wrong one –  cmhughes May 2 '12 at 19:13

1 Answer 1

Based on the error message the version of the pgfplots library is outdated. You should upgrade to the latest version.


Using the latest version, and correcting the typo in the last line:

\addplot coordinates {(1,  9.6)}; \addlegendentry{Version 4}

I get the plot shown below. There are probably other pgfplots/tikz libraries that need updating. If you are just starting out, it would be best to do a fresh install of TeXLive and go from there.

enter image description here

share|improve this answer
    
I changed the typo, but it is not the case. The problem is still there. –  gkaran89 May 2 '12 at 18:53

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