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.

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?

share|improve this question
1  
Could you include an MWE? –  Sean Allred Mar 29 '13 at 12:24
    
Done. Hope this is enough. –  Foo Bar Mar 29 '13 at 12:34
    
Sorry for replying late - internet is a little shoddy - but what exactly is in mydata.txt? (filecontents is a great environment if you're unaware ;)) –  Sean Allred Mar 29 '13 at 13:08
    
I added a part of the data to work with. –  Foo Bar Mar 29 '13 at 13:15
1  
Yes, scatter plot seems to be the right term (English is not my native language). I want these (x+-dx, y+-dy) value pairs plotted (with errobars, but with marks and without "connecting lines"). –  Foo Bar Mar 29 '13 at 13:29
show 2 more comments

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
Thank you very much, this works. :) –  Foo Bar Mar 29 '13 at 13:47
    
Thanks for the analysis. It should have worked to write only marks,mark=none. I will note this on the bug list for pgfplots to fix it eventually. –  Christian Feuersänger Mar 29 '13 at 15:48
    
Thanks, Christian! Yeah, it's weird that it doesn't work like that, but it may have something to do with mark=none resetting all other options (it said something about this in the documentation). –  Sean Allred Mar 29 '13 at 15:50
add comment

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.