[Tex/LaTex] tikzpicture – error bars

tikz-pgf

I am writing up a figure and I need the error bar associated to each point, I have the following:

\begin{tikzpicture}
    \datavisualization[visualize as smooth line/.list={lac10},
    scientific axes={clean},
    legend={at={(0.5,5)},anchor=north west},
    x axis={length=50mm,ticks={major={tick text padding=.5ex},node style={scale=1},minor steps between steps=1,step=2},label={Days}, include value={0,22}},
    y axis={length=50mm,ticks={major={tick text padding=.5ex},node style={scale=1},minor steps between steps=1,step=3},label={Laccase activity [U/g$_{ds}$]}, include value={0,33},},
    lac10={style={mark=*,mark size=1pt,mark options={solid,black},color=black},label in legend={text={\tiny 10.0 g}}},
    ]

    data[set=lac10]{
        x,y,ey
        0, 0, 0
        2, 0.2559, 0.0603
        4, 3.6438, 0.2075
        6, 8.0834, 0.6724
        8, 9.3111, 0.7168
        10, 3.3177, 0.2275
        12, 1.6083, 0.0820
        14, 26.0593, 1.5983
        16, 29.4135, 1.5789
        18, 24.3474, 1.3521
        20, 13.6993, 1.0829
    };


\end{tikzpicture}

At the end I don't get the error bars, just the points, I would like to know what do I miss or What do I have to add to the code. I would really appreciate all your suggestions.

Best Answer

Looking at the manual I couldn't see an easy way to do this without writing a custom visualizer.

However, PGFplots can produce something reasonably similar quite easily:

\documentclass[tikz,margin=5]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ymin=0, ymax=33, 
  ytick={0,3,...,33}, ytick align=outside, ytick pos=left,
  xtick={0,2,...,22}, xtick align=outside, xtick pos=left,
  xlabel=Days,
  ylabel={Laccase activity [U/g$_{ds}$]},
  legend pos=north west,
  legend style={draw=none}]
\addplot+[
  black, mark options={black, scale=0.75},
  smooth, 
  error bars/.cd, 
    y fixed,
    y dir=both, 
    y explicit
] table [x=x, y=y,y error=error, col sep=comma] {
    x,  y,       error
    0,  0,       0
    2,  0.2559,  0.0603
    4,  3.6438,  0.2075
    6,  8.0834,  0.6724
    8,  9.3111,  0.7168
    10, 3.3177,  0.2275
    12, 1.6083,  0.0820
    14, 26.0593, 1.5983
    16, 29.4135, 1.5789
    18, 24.3474, 1.3521
    20, 13.6993, 1.0829
};
\addlegendentry{10.0 g}
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Related Question