[Tex/LaTex] pgfplots: Points with no marks but errorbars

pgfplotsplot

How can I plot data points with pgfplots that have no marks, but error bars? If I try marks=none and enable errobars, I get big filled circles with errobars. If I change my mark to mark=+, for example, I have to adjust the mark size by hand, so that the errorbars are bigger than the mark.

The reason is, if I have error bars, I automatically have the actual data point: the point where the error bars cross. So I don't need an explicit mark , but as described, just setting mark=none doesn't seem to be enough to achieve this.

This plots filled circles with error bars as marks even mark=none is set:

\begin{tikzpicture}
  \begin{axis}
    \addplot[ only marks, mark=none,
              error bars/.cd, y dir=both, x dir=both, x explicit, y explicit]
       table [x index=0, y index=2, x error index=1, y error index=3]
       {mydata.txt};
  \end{axis}
\end{tikzpicture}

Part of the content of mydata.txt to work with:

3.414   8E-3    3.62    5E-2
1.570   2E-2    1.65    1E-1
3.809   9E-3    3.96    3E-2
4.340   2E-2    4.34    3E-2

How do I get error bars without an actual mark symbol, so that the point is "auto-marked" by the crossing of the error bars?

Best Answer

Add the no markers option to the axis, and then supply scatter, only marks to the plot. Seems paradoxical, but it works:

\documentclass{article}
\usepackage{tikz,pgfplots,filecontents}
\begin{filecontents*}{mydata.txt}
3.414   8E-3    3.62    5E-2
1.570   2E-2    1.65    1E-1
3.809   9E-3    3.96    3E-2
4.340   2E-2    4.34    3E-2
\end{filecontents*}

\pgfplotsset{compat=1.7}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[no markers]
    \addplot[scatter, only marks,
              error bars/.cd, 
              y dir=both, x dir=both,
              x explicit, y explicit]
       table [x index=0, y index=2, x error index=1, y error index=3]
       {mydata.txt};
  \end{axis}
\end{tikzpicture}
\end{document}

Output:

output

Related Question