TransWikia.com

pgfplotstable: create style by a loop

TeX - LaTeX Asked on December 5, 2020

I used

pgfplotsinvokeforeach{0,2,4}{
pgfplotstableset{every col no #1/.style={
column type/.add={>{columncolor{gray}}}{} }, }

to get a style for some columns. Since I need this for more complex problems:
Is this the correct way to create loop-like styles?

enter image description here

documentclass[a4paper]{article}
usepackage{colortbl}
usepackage{pgfplotstable}
pgfplotsset{compat=1.17}
pgfplotstableread[]{
X       Y1     Y2    Y3       Date 
1      10     0.1   100      2011-01-01     
2      20     0.2   200      2012-02-02     
3      30     0.3   300      2013-03-03     
4      40     0.4   400      2014-04-04     
5      50     0.5   500      2015-05-05     
}data

pgfplotsinvokeforeach{0,2,4}{
pgfplotstableset{every col no #1/.style={
column type/.add={>{columncolor{gray}}}{}       }, }
}

begin{document}
pgfplotstabletypeset[string type]{data}
end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP