[Tex/LaTex] pgfplots with symbolic x coords and error bars

pgfplots

I am trying to plot explicit error bars like this:

\begin{tikzpicture} 
\begin{axis} [symbolic x coords={Lighting,Computers,Total}]
\addplot+[only marks] plot[error bars/.cd, y dir=both, y explicit]
coordinates{
    (Lighting,0.12) +- (0.31,0.03)
    (Computers,0.06) +- (0.12,0.01) 
    (Total,0.07) +- (0.14,0.02)
};
\end{axis} 
\end{tikzpicture}

Except this produces a constant error instead of the explicit values I have provided. For example, for Lighting, it produces 0.12 +-0.03 (see below). Did I misread the manual?! There is also some weirdness with the labels on the x-axis and I'd rather not have the y-axis use exponential notation for y<0.1. (I tried posting the output, but apparently I need more cred!)

Best Answer

Starting from PGFPlots version 1.9, asymmetric error bars are directly supported:

\documentclass{article} 
\usepackage{pgfplots}

\pgfplotstableread{
x         y    y-max  y-min
Lighting  0.12 0.31   0.03
Computers 0.06 0.12   0.01 
Total     0.07 0.14   0.02
}{\mytable}

\begin{document}    
\begin{tikzpicture}
\begin{axis} [
    ymin=0,
    symbolic x coords={Lighting,Computers,Total},
    xtick=data
]
\addplot [only marks] 
  plot [error bars/.cd, y dir=both, y explicit]
  table [y error plus=y-max, y error minus=y-min] {\mytable};
\end{axis} 
\end{tikzpicture}

\end{document}

Related Question