tikzpicture-误差线

tikzpicture-误差线

我正在写一个图形,我需要与每个点相关的误差线,我有以下内容:

\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}

最后我没有得到错误栏,只得到了要点,我想知道我错过了什么或者我必须在代码中添加什么。我非常感谢你们的所有建议。

答案1

查看手册,我找不到不编写自定义可视化工具就轻松完成此操作的方法。

然而,PGFplots 可以很容易地产生相当类似的结果:

\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}

在此处输入图片描述

相关内容