[Tex/LaTex] PGFPlots grouped bar chart with error bars providing additional information above, convert point to string in comma for display


How can I get comma as a decimal separator in my upper axes (the number above the major grid)?

All suggestions to improve the graph are warmly welcomed.

basic requirement

  • using .csv data with (long) floats and errors
  • showing information in grouped pairs (same test body with different clamping setups)
  • with error-information (which are sometimes quite big)
  • I do not want show every value of every bar, but the mean of every group

I tried and got this, with the problem of the decimal separator being a point mean plot. (Also I do not want any marks or any other things to show up, and the label should be printed in black)

I got the basic setup from Manual for Package PGFSPLOTS chapter 8.6 page 551.

things i tried

I do not want to change my csv (using a semicolon as a separator and using the comma for decimal separation)
I am using sinuitx. If there's an option to apply this to the meta information it might be a shot.
I also tried {} around my label data in the .csv, but that did not help.

grouped bar char


% !TeX encoding = UTF-8
\documentclass[11pt, border=5pt]{standalone}
            /pgf/number format/.cd,
                use comma,
            height = 7cm,
            width = 8.5cm,
            ylabel={The mighty Force in \si{\newton}},
            xlabel={A strong Opponent},
            ymin = 0,
            ymax= 1.75,
            bar width=12pt,
            enlarge x limits = 0.3,
            nodes near coords,
            point meta=explicit symbolic,
            every node near coord/.style={
                    at={(\pgfkeysvalueof{/data point/x},1.8)},
            bar shift=0pt,
            x tick label style={rotate=45,anchor=east},
        \addplot+[bar shift = -12pt]
        plot [error bars/.cd, y dir=both, y explicit]
        table [x=ID, y=A, y error=Aun, col sep=comma] {data.csv};
        \addplot+[bar shift = +12pt]
        plot [error bars/.cd, y dir=both, y explicit]
        table [x=ID, y=B, y error=Bun, col sep=comma] {data.csv}; % Läd die Daten aus der CSV Datei
        plot [error bars/.cd, y dir=both, y explicit]
        table [x=ID, y=C, y error=Cun, col sep=comma] {data.csv}; % Läd die Daten aus der CSV Datei
        \addplot[only marks]
        plot table [x=ID, col sep=comma, meta=label] {data.csv}; % Läd die Daten aus der CSV Datei

The content of data.csv:


Best Answer

I tried different things and made therefore multiple mistakes. The following two ones are in addition to the solution important

  • Do not use one file where only index and meta is inside
  • Do not use \pgfplotstabletypeset in tikzpicture, see here

A simple working solution for my problem is changing the file format to space separated and that's it. The option explicit symbolic already handles the rest for reading the "new" .dat file correctly ...

barchart with proper meta labels