2

I'm fairly new to pgfplots and latex and strugling a bit with connecting points in pgfplots.

I have a bunch of points and want pgfplots to connect each point to the point next to them. To get a line around all points. Here is my code so far:

\documentclass {article}    
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.5}
\begin{document}
\begin{tikzpicture}
\begin{axis} [
    xmin=0,
    title={test},
    grid=major, 
    width=10cm,
    ]
    \addplot table [
        col sep=semicolon,
        mark=+
        ] 
        {data.dat};
\end{axis}
\end{tikzpicture}
\end{document}

But instead of connecting each point to the next one it does something like this: enter image description here

Is there anyone how can help me?

  • 3
    Looks like a sequence error in the file data.dat but without this file it is hard to tell. – albert Aug 05 '18 at 08:58
  • It seems to be due to the sorting of your points. As far as I know pgfplots plots the points line by line so you need to apply a sorting method prior to plotting. This post might help – BambOo Aug 05 '18 at 09:01
  • This is an interesting question, but without the data in data.dat we can't really reproduce this easily and so it will be difficult to help you if we have to make up data points before we can even investigate what is going on. – moewe Aug 12 '18 at 16:19

0 Answers0