I am using pgfplots
to create a bar chart, with the x-axis representing different categories. Using symbolic x coords
I can specify the labels for the categories. However, I am unable to use a mathematical expression to define the height of the bars (y coordinate). I suspect that this is related to the use of symbolic x coords
.
Here's a minimum (non-)working example:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[symbolic x coords={a,b,c,d,e,f}]
\addplot[ybar] coordinates {
(a, 1*2)
(b, 2*2)
(c, 3*2)
(d, 4*2)
(e, 5*2)
(f, 6*2)
};
\end{axis}
\end{tikzpicture}
\end{document}
The error I receive when compiling with pdflatex
is:
Package PGF Math Error: Could not parse input ' 1*2' as a floating point number, sorry. The unreadable part was near '*2'.
Any help would be greatly appreciated.