Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

According to the manual of pgfplotstable it is fairly easy to set the color of a whole row or a whole column of a table. However, I would like to style only one element located in a certain row and column.

There is \pgfplotstablegetelem{<row>}{<col>}\of{<table>} for accessing table elements.

I can style elements determined by their signs: columns/account1/.style={fonts by sign={}{\color{red}}}.

How can I style 22 in the following example identified by its row-columns-coordinates (colB,2)? This feature makes sense, if I load data from a file with plain data.

\pgfplotstabletypeset[col sep=&,row sep=\\,sci zerofill]{
  colA & colB & colC \\
  11   & 12   & 13   \\
  21   & 22   & 23   \\
}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

pgfplotstable up to version 1.4.1 only supports row- and column styles. However, it allows to query the \pgfplotstablerow and \pgfplotstablecol macros, so you can use the (admittadly arkward) syntax


\pgfplotstabletypeset[
    columns/colB/.style={%
        postproc cell content/.code={%
            \ifnum\pgfplotstablerow=1 
                \pgfkeysalso{@cell content=\textbf{##1}}%
            \fi
        },
    },
    col sep=&,row sep=\\]{
  colA & colB & colC \\
  11   & 12   & 13   \\
  21   & 22   & 23   \\
}

what it does it to assign a post-processor for the complete column. But the column-specific post-processor checks the row index and applies the action only for row index 1 (indexing starts at 0).

It appears as if I have forgotten this particular feature. I have just added a new feature to pgfplotstable which implements that specific application in a much simpler way (by defining a every row <index> column <name or index>/.style). If you need such a thing very often, you may want to watch for the pgfplots unstable version on the pgfplots sourceforge web page, I will upload the changes in the next days.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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