pgfplotstable - Make rows bold and add a backgroup color using values from two columns











up vote
3
down vote

favorite












I am trying to get some rows in my data to show both as bold and with a background color. More specifically, I want my table to have bold rows where Group = 1 and at the same time I want rows to have a background blue color if Color = 1.In this process i do not want to lose the precision in any of the columns.



I have tried several combinations, but have not been able to solve this problem. A MWE is posted below:



documentclass{report}

usepackage{pgfplotstable,booktabs, ifthen}
usepackage{colortbl}

pgfplotsset{compat=1.14}

begin{document}

pgfplotstableread[col sep= semicolon]{
A;B;C;Group;Color
C0;100;0.9;0;1
C1;90;16.0;1;1
C2;80;1.6;2;0
C3;70;1.0;0;1
C4;60;12.0;0;1
C5;50;13.5;1;0
}mytable

pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

pgfplotstabletypeset[
col sep = semicolon,
columns = {A, B, C, Group, Color },
columns/A/.style={ string type, column type = {l}},
columns/B/.style={ column type = {r}},
columns/C/.style={ column type = {r}, precision = 1},
columns/Group/.style={ column type = {r}, precision = 1},
columns/Color/.style={ column type = {r}, precision = 1},
%
every column/.style={
postproc cell content/.append code={
pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}
ifthenelse{ pgfplotsretval = 1 }
{pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$}}}
%
% Want to add red color to the rows where Color = 1, and keep the rows bold where Group = 1.
%
% Commented out: My attempt that did not work!
%
% pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}
% ifthenelse{ pgfplotsretval = 1 }
% {pgfkeyssetvalue{/pgfplots/table/@cell content}{relaxcellcolor{red}##1}}
%
}
}
]{mytable}

end{document}









share|improve this question


























    up vote
    3
    down vote

    favorite












    I am trying to get some rows in my data to show both as bold and with a background color. More specifically, I want my table to have bold rows where Group = 1 and at the same time I want rows to have a background blue color if Color = 1.In this process i do not want to lose the precision in any of the columns.



    I have tried several combinations, but have not been able to solve this problem. A MWE is posted below:



    documentclass{report}

    usepackage{pgfplotstable,booktabs, ifthen}
    usepackage{colortbl}

    pgfplotsset{compat=1.14}

    begin{document}

    pgfplotstableread[col sep= semicolon]{
    A;B;C;Group;Color
    C0;100;0.9;0;1
    C1;90;16.0;1;1
    C2;80;1.6;2;0
    C3;70;1.0;0;1
    C4;60;12.0;0;1
    C5;50;13.5;1;0
    }mytable

    pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

    pgfplotstabletypeset[
    col sep = semicolon,
    columns = {A, B, C, Group, Color },
    columns/A/.style={ string type, column type = {l}},
    columns/B/.style={ column type = {r}},
    columns/C/.style={ column type = {r}, precision = 1},
    columns/Group/.style={ column type = {r}, precision = 1},
    columns/Color/.style={ column type = {r}, precision = 1},
    %
    every column/.style={
    postproc cell content/.append code={
    pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}
    ifthenelse{ pgfplotsretval = 1 }
    {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$}}}
    %
    % Want to add red color to the rows where Color = 1, and keep the rows bold where Group = 1.
    %
    % Commented out: My attempt that did not work!
    %
    % pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}
    % ifthenelse{ pgfplotsretval = 1 }
    % {pgfkeyssetvalue{/pgfplots/table/@cell content}{relaxcellcolor{red}##1}}
    %
    }
    }
    ]{mytable}

    end{document}









    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am trying to get some rows in my data to show both as bold and with a background color. More specifically, I want my table to have bold rows where Group = 1 and at the same time I want rows to have a background blue color if Color = 1.In this process i do not want to lose the precision in any of the columns.



      I have tried several combinations, but have not been able to solve this problem. A MWE is posted below:



      documentclass{report}

      usepackage{pgfplotstable,booktabs, ifthen}
      usepackage{colortbl}

      pgfplotsset{compat=1.14}

      begin{document}

      pgfplotstableread[col sep= semicolon]{
      A;B;C;Group;Color
      C0;100;0.9;0;1
      C1;90;16.0;1;1
      C2;80;1.6;2;0
      C3;70;1.0;0;1
      C4;60;12.0;0;1
      C5;50;13.5;1;0
      }mytable

      pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

      pgfplotstabletypeset[
      col sep = semicolon,
      columns = {A, B, C, Group, Color },
      columns/A/.style={ string type, column type = {l}},
      columns/B/.style={ column type = {r}},
      columns/C/.style={ column type = {r}, precision = 1},
      columns/Group/.style={ column type = {r}, precision = 1},
      columns/Color/.style={ column type = {r}, precision = 1},
      %
      every column/.style={
      postproc cell content/.append code={
      pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}
      ifthenelse{ pgfplotsretval = 1 }
      {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$}}}
      %
      % Want to add red color to the rows where Color = 1, and keep the rows bold where Group = 1.
      %
      % Commented out: My attempt that did not work!
      %
      % pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}
      % ifthenelse{ pgfplotsretval = 1 }
      % {pgfkeyssetvalue{/pgfplots/table/@cell content}{relaxcellcolor{red}##1}}
      %
      }
      }
      ]{mytable}

      end{document}









      share|improve this question













      I am trying to get some rows in my data to show both as bold and with a background color. More specifically, I want my table to have bold rows where Group = 1 and at the same time I want rows to have a background blue color if Color = 1.In this process i do not want to lose the precision in any of the columns.



      I have tried several combinations, but have not been able to solve this problem. A MWE is posted below:



      documentclass{report}

      usepackage{pgfplotstable,booktabs, ifthen}
      usepackage{colortbl}

      pgfplotsset{compat=1.14}

      begin{document}

      pgfplotstableread[col sep= semicolon]{
      A;B;C;Group;Color
      C0;100;0.9;0;1
      C1;90;16.0;1;1
      C2;80;1.6;2;0
      C3;70;1.0;0;1
      C4;60;12.0;0;1
      C5;50;13.5;1;0
      }mytable

      pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

      pgfplotstabletypeset[
      col sep = semicolon,
      columns = {A, B, C, Group, Color },
      columns/A/.style={ string type, column type = {l}},
      columns/B/.style={ column type = {r}},
      columns/C/.style={ column type = {r}, precision = 1},
      columns/Group/.style={ column type = {r}, precision = 1},
      columns/Color/.style={ column type = {r}, precision = 1},
      %
      every column/.style={
      postproc cell content/.append code={
      pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}
      ifthenelse{ pgfplotsretval = 1 }
      {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$}}}
      %
      % Want to add red color to the rows where Color = 1, and keep the rows bold where Group = 1.
      %
      % Commented out: My attempt that did not work!
      %
      % pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}
      % ifthenelse{ pgfplotsretval = 1 }
      % {pgfkeyssetvalue{/pgfplots/table/@cell content}{relaxcellcolor{red}##1}}
      %
      }
      }
      ]{mytable}

      end{document}






      formatting conditionals pgfplotstable






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 19 '17 at 16:22









      ernieuhu

      313




      313






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote














          • BTW: I think, amazingly, there is no command every column/.style={...}
            €dit: ...in older versions of pgfplotstable. But, it does not matter, because we do not need this command in the following.


          • It seems, due to your different column styles, you have to repeat your if-condition for each relevant column; while respecting (and adding) the specific style for the current column.



          Your desired common styles are



          pgfplotstableset{
          CellColor/.style={postproc cell content/.append code={
          pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
          ifthenelse{pgfplotsretval = 1 }% if
          {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
          {}% else
          }},
          CellBold/.style={postproc cell content/.append code={
          pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
          ifthenelse{pgfplotsretval = 1 }% if
          {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
          {}% else
          }},
          }


          So you have to say:
          columns/A/.style={ string type, column type = {l},% specific column A
          CellColor, CellBold % common
          }


          analog for column B, but
          columns/C/.style={column type=r, precision = 1,% specific column C
          CellColor, CellBold % common
          }



          Alltogether:



          enter image description here



          documentclass[border=5pt, varwidth]{standalone}
          %documentclass{report}

          usepackage{pgfplotstable,booktabs, ifthen}
          usepackage{colortbl}
          pgfplotsset{compat=1.13}

          begin{document}
          pgfplotstableread[col sep= semicolon]{
          A;B;C;Group;Color
          C0;100;0.9;0;1
          C1;90;16.0;1;1
          C2;80;1.6;2;0
          C3;70;1.0;0;1
          C4;60;12.0;0;1
          C5;50;13.5;1;0
          }mytable

          pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

          pgfplotstableset{
          CellColor/.style={postproc cell content/.append code={
          pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
          ifthenelse{pgfplotsretval = 1 }% if
          {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
          {}% else
          }},
          CellBold/.style={postproc cell content/.append code={
          pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
          ifthenelse{pgfplotsretval = 1 }% if
          {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
          {}% else
          }},
          }


          pgfplotstabletypeset[,
          col sep = semicolon,
          columns = {A, B, C, Group, Color },
          % columns/A/.style={ string type, column type = {l}},
          % columns/B/.style={ column type = {r}},
          % columns/C/.style={ column type = {r}, precision = 1},
          columns/Group/.style={ column type = {r}, precision = 1},
          columns/Color/.style={ column type = {r}, precision = 1},
          %
          %every column/.style={} %
          %
          columns/A/.style={ string type, column type = {l},% specific column A
          CellColor, CellBold % common
          },
          columns/B/.style={column type=r,% specific column B
          CellColor, CellBold % common
          },
          columns/C/.style={column type=r, precision = 1,% specific column C
          CellColor, CellBold % common
          },
          ]{mytable}

          end{document}





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f354653%2fpgfplotstable-make-rows-bold-and-add-a-backgroup-color-using-values-from-two-c%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote














            • BTW: I think, amazingly, there is no command every column/.style={...}
              €dit: ...in older versions of pgfplotstable. But, it does not matter, because we do not need this command in the following.


            • It seems, due to your different column styles, you have to repeat your if-condition for each relevant column; while respecting (and adding) the specific style for the current column.



            Your desired common styles are



            pgfplotstableset{
            CellColor/.style={postproc cell content/.append code={
            pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
            ifthenelse{pgfplotsretval = 1 }% if
            {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
            {}% else
            }},
            CellBold/.style={postproc cell content/.append code={
            pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
            ifthenelse{pgfplotsretval = 1 }% if
            {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
            {}% else
            }},
            }


            So you have to say:
            columns/A/.style={ string type, column type = {l},% specific column A
            CellColor, CellBold % common
            }


            analog for column B, but
            columns/C/.style={column type=r, precision = 1,% specific column C
            CellColor, CellBold % common
            }



            Alltogether:



            enter image description here



            documentclass[border=5pt, varwidth]{standalone}
            %documentclass{report}

            usepackage{pgfplotstable,booktabs, ifthen}
            usepackage{colortbl}
            pgfplotsset{compat=1.13}

            begin{document}
            pgfplotstableread[col sep= semicolon]{
            A;B;C;Group;Color
            C0;100;0.9;0;1
            C1;90;16.0;1;1
            C2;80;1.6;2;0
            C3;70;1.0;0;1
            C4;60;12.0;0;1
            C5;50;13.5;1;0
            }mytable

            pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

            pgfplotstableset{
            CellColor/.style={postproc cell content/.append code={
            pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
            ifthenelse{pgfplotsretval = 1 }% if
            {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
            {}% else
            }},
            CellBold/.style={postproc cell content/.append code={
            pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
            ifthenelse{pgfplotsretval = 1 }% if
            {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
            {}% else
            }},
            }


            pgfplotstabletypeset[,
            col sep = semicolon,
            columns = {A, B, C, Group, Color },
            % columns/A/.style={ string type, column type = {l}},
            % columns/B/.style={ column type = {r}},
            % columns/C/.style={ column type = {r}, precision = 1},
            columns/Group/.style={ column type = {r}, precision = 1},
            columns/Color/.style={ column type = {r}, precision = 1},
            %
            %every column/.style={} %
            %
            columns/A/.style={ string type, column type = {l},% specific column A
            CellColor, CellBold % common
            },
            columns/B/.style={column type=r,% specific column B
            CellColor, CellBold % common
            },
            columns/C/.style={column type=r, precision = 1,% specific column C
            CellColor, CellBold % common
            },
            ]{mytable}

            end{document}





            share|improve this answer



























              up vote
              1
              down vote














              • BTW: I think, amazingly, there is no command every column/.style={...}
                €dit: ...in older versions of pgfplotstable. But, it does not matter, because we do not need this command in the following.


              • It seems, due to your different column styles, you have to repeat your if-condition for each relevant column; while respecting (and adding) the specific style for the current column.



              Your desired common styles are



              pgfplotstableset{
              CellColor/.style={postproc cell content/.append code={
              pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
              ifthenelse{pgfplotsretval = 1 }% if
              {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
              {}% else
              }},
              CellBold/.style={postproc cell content/.append code={
              pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
              ifthenelse{pgfplotsretval = 1 }% if
              {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
              {}% else
              }},
              }


              So you have to say:
              columns/A/.style={ string type, column type = {l},% specific column A
              CellColor, CellBold % common
              }


              analog for column B, but
              columns/C/.style={column type=r, precision = 1,% specific column C
              CellColor, CellBold % common
              }



              Alltogether:



              enter image description here



              documentclass[border=5pt, varwidth]{standalone}
              %documentclass{report}

              usepackage{pgfplotstable,booktabs, ifthen}
              usepackage{colortbl}
              pgfplotsset{compat=1.13}

              begin{document}
              pgfplotstableread[col sep= semicolon]{
              A;B;C;Group;Color
              C0;100;0.9;0;1
              C1;90;16.0;1;1
              C2;80;1.6;2;0
              C3;70;1.0;0;1
              C4;60;12.0;0;1
              C5;50;13.5;1;0
              }mytable

              pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

              pgfplotstableset{
              CellColor/.style={postproc cell content/.append code={
              pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
              ifthenelse{pgfplotsretval = 1 }% if
              {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
              {}% else
              }},
              CellBold/.style={postproc cell content/.append code={
              pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
              ifthenelse{pgfplotsretval = 1 }% if
              {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
              {}% else
              }},
              }


              pgfplotstabletypeset[,
              col sep = semicolon,
              columns = {A, B, C, Group, Color },
              % columns/A/.style={ string type, column type = {l}},
              % columns/B/.style={ column type = {r}},
              % columns/C/.style={ column type = {r}, precision = 1},
              columns/Group/.style={ column type = {r}, precision = 1},
              columns/Color/.style={ column type = {r}, precision = 1},
              %
              %every column/.style={} %
              %
              columns/A/.style={ string type, column type = {l},% specific column A
              CellColor, CellBold % common
              },
              columns/B/.style={column type=r,% specific column B
              CellColor, CellBold % common
              },
              columns/C/.style={column type=r, precision = 1,% specific column C
              CellColor, CellBold % common
              },
              ]{mytable}

              end{document}





              share|improve this answer

























                up vote
                1
                down vote










                up vote
                1
                down vote










                • BTW: I think, amazingly, there is no command every column/.style={...}
                  €dit: ...in older versions of pgfplotstable. But, it does not matter, because we do not need this command in the following.


                • It seems, due to your different column styles, you have to repeat your if-condition for each relevant column; while respecting (and adding) the specific style for the current column.



                Your desired common styles are



                pgfplotstableset{
                CellColor/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
                {}% else
                }},
                CellBold/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
                {}% else
                }},
                }


                So you have to say:
                columns/A/.style={ string type, column type = {l},% specific column A
                CellColor, CellBold % common
                }


                analog for column B, but
                columns/C/.style={column type=r, precision = 1,% specific column C
                CellColor, CellBold % common
                }



                Alltogether:



                enter image description here



                documentclass[border=5pt, varwidth]{standalone}
                %documentclass{report}

                usepackage{pgfplotstable,booktabs, ifthen}
                usepackage{colortbl}
                pgfplotsset{compat=1.13}

                begin{document}
                pgfplotstableread[col sep= semicolon]{
                A;B;C;Group;Color
                C0;100;0.9;0;1
                C1;90;16.0;1;1
                C2;80;1.6;2;0
                C3;70;1.0;0;1
                C4;60;12.0;0;1
                C5;50;13.5;1;0
                }mytable

                pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

                pgfplotstableset{
                CellColor/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
                {}% else
                }},
                CellBold/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
                {}% else
                }},
                }


                pgfplotstabletypeset[,
                col sep = semicolon,
                columns = {A, B, C, Group, Color },
                % columns/A/.style={ string type, column type = {l}},
                % columns/B/.style={ column type = {r}},
                % columns/C/.style={ column type = {r}, precision = 1},
                columns/Group/.style={ column type = {r}, precision = 1},
                columns/Color/.style={ column type = {r}, precision = 1},
                %
                %every column/.style={} %
                %
                columns/A/.style={ string type, column type = {l},% specific column A
                CellColor, CellBold % common
                },
                columns/B/.style={column type=r,% specific column B
                CellColor, CellBold % common
                },
                columns/C/.style={column type=r, precision = 1,% specific column C
                CellColor, CellBold % common
                },
                ]{mytable}

                end{document}





                share|improve this answer















                • BTW: I think, amazingly, there is no command every column/.style={...}
                  €dit: ...in older versions of pgfplotstable. But, it does not matter, because we do not need this command in the following.


                • It seems, due to your different column styles, you have to repeat your if-condition for each relevant column; while respecting (and adding) the specific style for the current column.



                Your desired common styles are



                pgfplotstableset{
                CellColor/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
                {}% else
                }},
                CellBold/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
                {}% else
                }},
                }


                So you have to say:
                columns/A/.style={ string type, column type = {l},% specific column A
                CellColor, CellBold % common
                }


                analog for column B, but
                columns/C/.style={column type=r, precision = 1,% specific column C
                CellColor, CellBold % common
                }



                Alltogether:



                enter image description here



                documentclass[border=5pt, varwidth]{standalone}
                %documentclass{report}

                usepackage{pgfplotstable,booktabs, ifthen}
                usepackage{colortbl}
                pgfplotsset{compat=1.13}

                begin{document}
                pgfplotstableread[col sep= semicolon]{
                A;B;C;Group;Color
                C0;100;0.9;0;1
                C1;90;16.0;1;1
                C2;80;1.6;2;0
                C3;70;1.0;0;1
                C4;60;12.0;0;1
                C5;50;13.5;1;0
                }mytable

                pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill, precision=0, set thousands separator={}}

                pgfplotstableset{
                CellColor/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Color}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={cellcolor{red}}{}}}% then
                {}% else
                }},
                CellBold/.style={postproc cell content/.append code={
                pgfplotstablegetelem{pgfplotstablerow}{Group}of{mytable}%
                ifthenelse{pgfplotsretval = 1 }% if
                {pgfkeysalso{/pgfplots/table/@cell content/.add={$bf}{$} }}% then
                {}% else
                }},
                }


                pgfplotstabletypeset[,
                col sep = semicolon,
                columns = {A, B, C, Group, Color },
                % columns/A/.style={ string type, column type = {l}},
                % columns/B/.style={ column type = {r}},
                % columns/C/.style={ column type = {r}, precision = 1},
                columns/Group/.style={ column type = {r}, precision = 1},
                columns/Color/.style={ column type = {r}, precision = 1},
                %
                %every column/.style={} %
                %
                columns/A/.style={ string type, column type = {l},% specific column A
                CellColor, CellBold % common
                },
                columns/B/.style={column type=r,% specific column B
                CellColor, CellBold % common
                },
                columns/C/.style={column type=r, precision = 1,% specific column C
                CellColor, CellBold % common
                },
                ]{mytable}

                end{document}






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 18 at 11:45

























                answered Nov 10 at 13:10









                cis

                607514




                607514






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f354653%2fpgfplotstable-make-rows-bold-and-add-a-backgroup-color-using-values-from-two-c%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?