I am trying to create a very basic bar chart using pgfplots. I need four bars representing percentages with text as labels under the x axis. Text labels contain spaces and accented, non-English characters.

Since I use pgfplots for all other charts in my paper I thought I'd give a shot at this one, too. However, since this chart uses non-numeric x values it's a little tricky. I'm trying to start with a text book example and go from there. Here's the example from the pgfplots manual (4.20.1 on p. 210) I'm trying to use:




\begin{axis}[symbolic x coords={a,b,c,d,e,f,g,h,i}]
\addplot+[smooth] coordinates {


I have major problems with this code. For starters, TeXmaker hangs while trying to compile, I have to kill the pdflatex process to reanimate it. When I do I get the following error messages:

! Package pgfkeys Error: I do not know the key '/pgfplots/compat' and I am goin g to ignore it. Perhaps you misspelled it.

! Package PGF Math Error: Could not parse input 'a' as a floating point number, sorry. The unreadable part was near 'a'..

If someone could shed some light on what I'm doing wrong I'd most appreciate it. I am using a recent version of Ubuntu and TeX Live (2009-10). I have been using them for a year or so, never had a hang issue so far.

Recommendations for any other solution (preferably without any external program) are also welcome and appreciated. Thanks.


The version of pgfplots that is included in Ubuntu 10.10 is 1.2.2. Apparently the feature that you are using was added between then and version 1.4.1 (which is the current version).

Unless someone comes up with a workaround to add text coordinates in pgfplot 1.2, the easiest option for you is probably to upgrade to TeX Live 2010. Installing it manually isn't too hard and you will get all the newest versions. PGF related packages changed a lot since the TeX Live version that is included in Ubuntu. Also, you will be able to run tlmgr update --self --all to update your TeX installation at any time.

Here is a proof-of-concept with version 1.4 (I don't know pgfplots well, so there might be a better way to do this):



    symbolic x coords={a small bar,a medium bar,a large bar},
    \addplot[ybar,fill=blue] coordinates {
        (a small bar,42)
        (a medium bar,50)
        (a large bar,80)



  • Thank you, Caramdir. I will see if I can upgrade my TeX Live.
    – Heisenb0rg
    Jan 9 '11 at 18:14
  • I'm new to this UI... I press enters way too often. So, Caramdir, would you be able to say if it is possible to draw the chart I mention in my original question using TeX Live 2010 and pgfplots? Thanks.
    – Heisenb0rg
    Jan 9 '11 at 18:21
  • @Heisenb0rg: Yes.
    – Alan Munn
    Jan 9 '11 at 18:28
  • Thank you, Alan. I'll give it a try and see if I can do it.
    – Heisenb0rg
    Jan 9 '11 at 18:30
  • @Heisenb0rg, see the edited answer.
    – Caramdir
    Jan 9 '11 at 18:48

As a small sidenote: Updating pgfplots to 1.4.1 (on Ubuntu Natty, texlive 2009) while leaving the rest of the packages unaltered, did not resolve this issue for me. Installing a completely separately texlive 2010 did resolve the issue. I was trying the "lazy" approach first... so, for all other lazy people: no need to try this, go with the correct solution as proposed by Caramdir. Btw... Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.