I would like to create a plot with error bars in which y is restricted to a given domain.
Unfortunately, restrict y to domain
does not seem to work with error bars.
\documentclass{article}
\usepackage{pgfplots}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\pgfplotsset{compat=newest}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
scaled ticks=false,
width = 0.9\linewidth,
height = 0.5562\linewidth,
xlabel={\footnotesize Testinstanzen},
ylabel={\footnotesize relative Abweichung},
xtick=\empty,
yticklabel={\footnotesize ~\pgfmathparse{\tick*100}\pgfmathprintnumber{\pgfmathresult}\%}
]
\addplot+[only marks,
color = blue,
mark = *,
mark options={fill=blue},
mark size = 1.5,
error bars/.cd,
error bar style={color=blue},
y dir = both,
y explicit,
x dir = none]
table[x index={0},y index={1}, y error plus index ={2}, y error minus index ={3}]plots/data/data.dat};
\end{axis}
\end{tikzpicture}
\end{document}
This code creates the following plot:
I would like to restrict y from 0% to 1%, so that the error bars are easier to recongnize. The long error bar at the fourth dot should end at the very top of the plot to indicate that the corresponding value is even higher than 1%.
Thank you very much for your help!
Example data file "data.dat":
0 0.0274 0.0775 0.0274
1 0.0275 0.0386 0.0271
2 0.0274 0.0407 0.0274
3 0.0260 0.0570 0.0247
4 0.0297 0.0560 0.0248
5 0.0465 0.1102 0.0405
6 0.0371 0.0808 0.0371
7 0.0381 0.0471 0.0337
8 0.0267 0.0387 0.0234
9 0.0247 0.0274 0.0247
ymax=0.15
to set the visible range. Does that solve the problem?