Graphics, Figures & Tablespgfplots | Plot Coordinates not accepted

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pranav
Posts: 5
Joined: Mon Nov 26, 2012 9:24 am

pgfplots | Plot Coordinates not accepted

Post by pranav »

Hi,

I want to plot following data using pgfplots.

Code: Select all

(1.3 , 0.006418)
(1.6 , 0.015143)
(1.9 , 0.010009)
(2.2 , 0.014109)
(2.5 , 0.009640)
I am adding here a snippet from the source file used for plotting it:

Code: Select all

\begin{figure}
  \begin{tikzpicture}
    \begin{axis}[
      height=4cm,
      width=9cm,
      grid=major,
      xlabel=Distance,
      ylabel=\% deviation from mean,
      xmin=1.2,
      xmax=2.6,
      domain=1.2:2.6
    ]
      \addplot coordinates {(1.3,0.006418),(1.6,0.015143),(1.9,0.010009),(2.2,0.014109),(2.5,0.009640)};
      \addlegendentry{CPSS}
      \addplot coordinates {(1.3,0.032756),(1.6,0.017977),(1.9,0.020863),(2.2,0.034741),(2.5,0.049633)};
      \addlegendentry{Kinect}
    \end{axis}
  \end{tikzpicture}
\end{figure}
But I am getting error:

Code: Select all

! Package pgfplots Error: Sorry, I could not read the plot coordinates near ',(
1.6,0.017977),(1.9,0.020863),(2.2,0.034741),(2.5,0.049633) '. Please check for 
format mistakes.
Last edited by cgnieder on Mon Nov 26, 2012 1:56 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

pranav
Posts: 5
Joined: Mon Nov 26, 2012 9:24 am

pgfplots | Plot Coordinates not accepted

Post by pranav »

Hi,

sorry for the silly mistake. In the code I have written

Code: Select all

\addplot coordinates {(1.3,0.006418),(1.6,0.015143),(1.9,0.010009),(2.2,0.014109),(2.5,0.009640)};
Here the comma must not be added between successive coordinates. :oops:
Last edited by cgnieder on Mon Nov 26, 2012 1:57 pm, edited 1 time in total.
Post Reply