Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[10pt,twocolumn,letterpaper]{article}
- usepackage[table]{xcolor}
- usepackage{pgfplotstable}
- %for confusion table
- pgfplotstableset{
- precision=1,
- fixed,
- fixed zerofill,
- /color cells/min/.initial=0,
- /color cells/max/.initial=1000,
- /color cells/textcolor/.initial=,
- %
- % Usage: 'color cells={min=<value which is mapped to lowest color>,
- % max = <value which is mapped to largest>}
- color cells/.code={%
- pgfqkeys{/color cells}{#1}%
- pgfkeysalso{%
- postproc cell content/.code={%
- %
- begingroup
- %
- % acquire the value before any number printer changed
- % it:
- pgfkeysgetvalue{/pgfplots/table/@preprocessed cell content}value
- ifxvalueempty
- endgroup
- else
- pgfmathfloatparsenumber{value}%
- pgfmathfloattofixed{pgfmathresult}%
- letvalue=pgfmathresult
- %
- % map that value:
- pgfplotscolormapaccess
- [pgfkeysvalueof{/color cells/min}:pgfkeysvalueof{/color cells/max}]
- {value}
- {pgfkeysvalueof{/pgfplots/colormap name}}%
- % now, pgfmathresult contains {<R>,<G>,<B>}
- %
- % acquire the value AFTER any preprocessor or
- % typesetter (like number printer) worked on it:
- pgfkeysgetvalue{/pgfplots/table/@cell content}typesetvalue
- pgfkeysgetvalue{/color cells/textcolor}textcolorvalue
- %
- % tex-expansion control
- % see http://tex.stackexchange.com/questions/12668/where-do-i-start-latex-programming/27589#27589
- toks0=expandafter{typesetvalue}%
- %%% my try to replicate the header row starts here
- xdefIII{0}
- ifnumIII=pgfplotstablecolrelax
- defaddedContent{ pgfplotstablecolname &}%
- else
- defaddedContent{}%
- fi
- %%% my try ends here: problem, I dont have access to the column header names
- xdeftemp{%
- noexpandpgfkeysalso{%
- @cell content={%
- addedContent
- noexpandcellcolor[rgb]{pgfmathresult}%
- noexpanddefinecolor{mapped color}{rgb}{pgfmathresult}%
- ifxtextcolorvalueempty
- else
- noexpandcolor{textcolorvalue}%
- fi
- thetoks0 %
- }%
- }%
- }%
- endgroup
- temp
- fi
- }%
- }%
- },
- every head row/.style={
- before row=&,
- },
- every first column/.style={
- column type/.add={c}{},
- },
- }
- begin{document}
- begin{table}
- caption{What I have}
- centering
- setlength{tabcolsep}{1pt}
- pgfplotstabletypeset[
- /pgfplots/colormap={CM}{color=(white) rgb255=(255,170,0)},
- color cells={min=0,max=100,textcolor=black},
- col sep=space,row sep=\
- ]{A E F I \
- 98.07692 9.25926 2.33516 0.00000\
- 0.00000 74.07407 3.02198 0.00000\
- 0.00000 0.00000 58.79121 0.00000\
- 0.00000 3.70370 1.64835 100.00000\
- }
- end{table}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement