34

I am attempting to make a scatter plot from a table of data. I seem to have almost succeeded, but there are lines between the points. I do not want this to happen, but I can't figure out how to remove them. My current code is

\begin{tikzpicture}[domain=0:3]
\begin{axis}[xlabel={$T_{\text{meas}}$}, ylabel={$T_{\text{cal}}$}]
\addplot[scatter, scatter src=\thisrow{class},
      error bars/.cd, y dir=both, x dir=both, y explicit, x explicit, error bar style={color=mapped color}]
      table[x=x,y=y,x error=xerr,y error=yerr] {
    x       xerr    y        yerr       class
    0.98521 0.00031 1        0.000001   0
    0.49238 0.00044 0.5      0.00000025 0
    1.09346 0.00032 1.111111 0.0000012  0
    1.23021 0.00078 1.25     0.0000016  0
    1.40567 0.00047 1.428571 0.000002   0
    1.63971 0.00064 1.666667 0.0000028  0
    1.96753 0.00063 2        0.000004   0
};
\end{axis}
\end{tikzpicture}

This creates a plot that looks like this scatter plot with lines

but I want it to look like this

scatter plot without lines

How can I make this happen?

1 Answer 1

38

You need to add the only marks option to the \addplot:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}[domain=0:3]
\begin{axis}[xlabel={$T_{\text{meas}}$}, ylabel={$T_{\text{cal}}$}]
\addplot[scatter, only marks, scatter src=\thisrow{class},
      error bars/.cd, y dir=both, x dir=both, y explicit, x explicit, error bar style={color=mapped color}]
      table[x=x,y=y,x error=xerr,y error=yerr] {
    x       xerr    y        yerr       class
    0.98521 0.00031 1        0.000001   0
    0.49238 0.00044 0.5      0.00000025 0
    1.09346 0.00032 1.111111 0.0000012  0
    1.23021 0.00078 1.25     0.0000016  0
    1.40567 0.00047 1.428571 0.000002   0
    1.63971 0.00064 1.666667 0.0000028  0
    1.96753 0.00063 2        0.000004   0
};
\end{axis}
\end{tikzpicture}
\end{document}
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .