I'm trying to use a macro for pgfplotstable labels but the macro is treated as a single entry of a csl rather than a csl.

The Question asked in Using a macro as value of addtotoc in \includepdf answered my question but I'm not able to do the same.


category, value, value 2
cat a,  1,  7
cat b,  2,  6
cat c,  3,  5
cat d,  4,  4
cat e,  5,  3
cat f,  6,  2
cat g,  7,  1

The code:


                 xlabel=X Label,
                 ylabel=Y Label,
                 xticklabel style={text height=1.5ex},
                 nodes near coords,
                 nodes near coords align={vertical},
                 area legend,
                 legend pos=outer north east,
                 legend entries={a,b},
                 bar width=3mm]
      \addplot table [x expr=\coordindex, y=value, col sep=comma] {test.csv};
      \addplot table [x expr=\coordindex, y=value 2, col sep=comma] {test.csv};

Manually typing out


shows the labels for each column (rather than clustered to label the first column)

Is there an easy way to be able to put a macro there?


  • Use xticklabels/.expand once=\blah instead of just xticklabels=\blah – Jake Jan 7 '14 at 21:24
  • @Jake You my friend, are awesome! – dsm5 Jan 7 '14 at 22:09

@Jake had the answer in the comment:

Use xticklabels/.expand once=\blah instead of xticklabels=\blah


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.