Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. documentclass[10pt,twocolumn,letterpaper]{article}
  2.  
  3. usepackage[table]{xcolor}
  4. usepackage{pgfplotstable}
  5.  
  6. %for confusion table
  7.  
  8. pgfplotstableset{
  9. precision=1,
  10. fixed,
  11. fixed zerofill,
  12. /color cells/min/.initial=0,
  13. /color cells/max/.initial=1000,
  14. /color cells/textcolor/.initial=,
  15. %
  16. % Usage: 'color cells={min=<value which is mapped to lowest color>,
  17. % max = <value which is mapped to largest>}
  18. color cells/.code={%
  19. pgfqkeys{/color cells}{#1}%
  20. pgfkeysalso{%
  21. postproc cell content/.code={%
  22. %
  23. begingroup
  24. %
  25. % acquire the value before any number printer changed
  26. % it:
  27. pgfkeysgetvalue{/pgfplots/table/@preprocessed cell content}value
  28. ifxvalueempty
  29. endgroup
  30. else
  31. pgfmathfloatparsenumber{value}%
  32. pgfmathfloattofixed{pgfmathresult}%
  33. letvalue=pgfmathresult
  34. %
  35. % map that value:
  36. pgfplotscolormapaccess
  37. [pgfkeysvalueof{/color cells/min}:pgfkeysvalueof{/color cells/max}]
  38. {value}
  39. {pgfkeysvalueof{/pgfplots/colormap name}}%
  40. % now, pgfmathresult contains {<R>,<G>,<B>}
  41. %
  42. % acquire the value AFTER any preprocessor or
  43. % typesetter (like number printer) worked on it:
  44. pgfkeysgetvalue{/pgfplots/table/@cell content}typesetvalue
  45. pgfkeysgetvalue{/color cells/textcolor}textcolorvalue
  46. %
  47. % tex-expansion control
  48. % see http://tex.stackexchange.com/questions/12668/where-do-i-start-latex-programming/27589#27589
  49. toks0=expandafter{typesetvalue}%
  50. %%% my try to replicate the header row starts here
  51. xdefIII{0}
  52. ifnumIII=pgfplotstablecolrelax
  53. defaddedContent{ pgfplotstablecolname &}%
  54. else
  55. defaddedContent{}%
  56. fi
  57. %%% my try ends here: problem, I dont have access to the column header names
  58. xdeftemp{%
  59. noexpandpgfkeysalso{%
  60. @cell content={%
  61. addedContent
  62. noexpandcellcolor[rgb]{pgfmathresult}%
  63. noexpanddefinecolor{mapped color}{rgb}{pgfmathresult}%
  64. ifxtextcolorvalueempty
  65. else
  66. noexpandcolor{textcolorvalue}%
  67. fi
  68. thetoks0 %
  69. }%
  70. }%
  71. }%
  72. endgroup
  73. temp
  74. fi
  75. }%
  76. }%
  77. },
  78. every head row/.style={
  79. before row=&,
  80. },
  81. every first column/.style={
  82. column type/.add={c}{},
  83. },
  84. }
  85.  
  86.  
  87.  
  88. begin{document}
  89. begin{table}
  90. caption{What I have}
  91. centering
  92. setlength{tabcolsep}{1pt}
  93. pgfplotstabletypeset[
  94. /pgfplots/colormap={CM}{color=(white) rgb255=(255,170,0)},
  95. color cells={min=0,max=100,textcolor=black},
  96. col sep=space,row sep=\
  97. ]{A E F I \
  98. 98.07692 9.25926 2.33516 0.00000\
  99. 0.00000 74.07407 3.02198 0.00000\
  100. 0.00000 0.00000 58.79121 0.00000\
  101. 0.00000 3.70370 1.64835 100.00000\
  102. }
  103. end{table}
  104. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement