4

When trying to insert a TikZ figure, using \addplot, I've got an 'undefined control sequence'. My code is:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}

\begin{tikzpicture}[scale=2]
\addplot[only marks] file[x index=0, y index=1]{baba.txt};
\end{tikzpicture}

\end{document}

where baba.txt is just the simple table:

0 1
1 0
1 1
0 0

Can anyone help me with this?

  • what is the exact error after that message ? – percusse Jun 22 '16 at 18:26
  • Are you missing axis environment? – Jeffery Shivers Jun 22 '16 at 18:29
3

Is this what you want?

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}

\begin{tikzpicture}[scale=2]
  \begin{axis}
\addplot+[only marks] file[x index=0, y index=1]{baba.txt};
  \end{axis}
\end{tikzpicture}

\end{document}
  • NP - please mark this as answered to remove it from the queue. :] The documentation goes into detail about using the different axis environments. – Jeffery Shivers Jun 22 '16 at 18:41

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.