调整条形图(y 限制)和误差线

调整条形图(y 限制)和误差线

在以下代码中,我在调整 y 限制以包含 y 轴上的误差线和零点时遇到了一些问题:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}


\begin{tikzpicture}
\begin{axis}[
    title = {X},
    width=7cm,
height= 9cm,
    xtick={1,...,3},
    xticklabels={%
        c1,
        c2,
        c3},
    ybar,
    ymajorgrids=true,
          x tick label style={rotate=45,anchor=east},
    x=70,
bar width=0.5cm,
enlarge x limits={abs=0.5cm},
ylabel = {V},
legend pos=outer north east,
enlarge y limits={0.55,upper},
enlarge y limits={0.386,lower},
enlarge x limits=0.25
           ]

\addplot[
    fill=blue!25,
    draw=black,
    point meta=y,
    every node near coord/.style={inner ysep=10pt},
    error bars/.cd,
        y dir=both,
        y explicit
] 
table [y error=error] {
x   y           error    label
1   9.642857143   1.949620581 1 
2   9.357142857    2.767338661 2
3   11.85714286   3.907084095 3 
};

\addplot[
    fill=red!25,
    draw=black,
    point meta=y,
    every node near coord/.style={inner ysep=10pt},
    error bars/.cd,
        y dir=both,
        y explicit
] 
table [y error=error] {
x   y           error    label
1   9.071428571   2.520325538 1 
2   8.642857143    4.26961261 1
3   7.0714286   2.4042904 1  
};

\draw ({rel axis cs:0,0}|-{axis cs:0,0}) -- ({rel axis cs:1,0}|-{axis cs:0,0});
\legend{one,two}

\end{axis}
\end{tikzpicture}


\end{document}

一个条形图的误差线未包含在图中。

另外我想知道表格下面第三列是什么意思? table [y error=error] { xy error label 1 9.071428571 2.5203​​255381(1)。

提前谢谢您,

埃里克

相关内容