[Tex/LaTex] PGFplotstable: Is it possible to set a number format for a *row* instead of a column


Using pgfplotstable, it's straightforward to set a column number format using


What I would like to do is change the number format of a particular row. In my case, the last row of my table is in percent format, whereas the rest of the table is fixed point format.

Is there a way to set the number format of a row, that overrides the number format of all the columns?

As a follow-up question, is there a number format preset for percentages?


I've now got it closer to working, thanks to Christian. However, I'm now having an issue where two "%" signs appear in each of the columns that dec sep align creates. How can I remove the first one? See the last row of the image to understand what I mean.

enter image description here

Best Answer

Pgfplotstable has styles like every row no <index> and some other styles as well.

However, these styles are applied quite late in the processing: the content is already fixed at that stage.

I accept this as a feature request.

However, there is a simple way to enable such a style: the styles named every row <rowindex> column <colindex>. These styles allow changes to the content generation, in particular, they respect changes to the number format.

You can group a sequence of such styles to change all values of a specific column easily using




    % #1 = row index
    % #2 = row style keys
    row style/.style 2 args={
        every row #1 column 0/.style={#2},
        every row #1 column 1/.style={#2},
        every row #1 column 2/.style={#2},
        every row #1 column 3/.style={#2},
        every row #1 column 4/.style={#2},
        every row #1 column 5/.style={#2},
        every row #1 column 6/.style={#2},
        every row #1 column 7/.style={#2},
        every row #1 column 8/.style={#2},
        every row #1 column 9/.style={#2},
        every row #1 column 10/.style={#2},

    row style={3}{sci},
    a b
    0 0
    1 1
    2 2
    3 3
    4 4
    5 5
    6 6
    7 7
    8 8
    9 9
    10 10


EDIT: concerning your second question: you wanted to format percentages (i.e. to multiply with 100 and to append '%'):

enter image description here




        column type=r,
        postproc cell content/.append style={
            /pgfplots/table/@cell content/.add={}{\%},
        fixed zerofill,