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 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?

share|improve this question

1 Answer 1

up vote 14 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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