SHARE
TWEET

Untitled

a guest Jun 24th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. documentclass{standalone}
  2.  
  3. usepackage{pgfplots}
  4. pgfplotsset{compat=newest}
  5.  
  6. usepackage{pgfplotstable}
  7. usepackage{filecontents}
  8.  
  9.  
  10. begin{filecontents}{fulltable.dat}
  11. houses  instance    value
  12. 20      1           8919
  13. 20      2           8965
  14. 20      3           8901
  15. 20      4           8816
  16. 20      5           8875
  17. 20      6           9027
  18. 20      7           8915
  19. 20      8           8907
  20. 20      9           8832
  21. 20      10          8934
  22. 200     1           84714
  23. 200     3           85630
  24. 200     4           84748
  25. 200     5           84565
  26. 200     6           85109
  27. 200     7           84588
  28. 200     8           84638
  29. 200     9           84673
  30. 200     10          85170
  31. end{filecontents}
  32.  
  33.  
  34. begin{document}
  35.  
  36. pgfplotsset{
  37.     discard if not/.style 2 args={
  38.         x filter/.code={
  39.             edeftempa{thisrow{#1}}
  40.             edeftempb{#2}
  41.             ifxtempatempb
  42.             else
  43.                 defpgfmathresult{inf}
  44.             fi
  45.         }
  46.     }
  47. }
  48.  
  49. pgfplotstableread{fulltable.dat}fulltable
  50.  
  51. begin{tikzpicture}[trim axis left]
  52.   begin{axis}[
  53.       title={{bfseries Plot for 20 houses instances}},
  54.       xlabel={Instance},
  55.       ylabel={Value}]
  56.     addplot+[only marks, discard if not={houses}{20}] table[x=instance, y=value]
  57.       {fulltable.dat};
  58.   end{axis}
  59. end{tikzpicture}
  60.  
  61. begin{tikzpicture}[trim axis left]
  62.   begin{axis}[
  63.       title={{bfseries Plot for 20 houses instances}},
  64.       xlabel={Instance},
  65.       ylabel={Value}]
  66.     addplot+[only marks, discard if not={houses}{20}] table[x=instance, y=value]
  67.       {fulltable};
  68.   end{axis}
  69. end{tikzpicture}
  70.  
  71. end{document}
  72.      
  73. defthisrowunavailableloadtabledirectly{thisrow_unavailable_load_table_directly}
  74. defsudogetthisrow#1#2{
  75.     edef#2{thisrow{#1}}
  76.     ifx#2thisrowunavailableloadtabledirectly % if thisrow fails to get the element
  77.                             % then #2 is thisrow_unavailable_load_table_directlye
  78.                             % we have a backup
  79.         getthisrow{#1}{}
  80.         let#2=pgfplotsretval
  81.     fi
  82. }
  83.  
  84. pgfplotsset{
  85.     discard if not/.style 2 args={
  86.         x filter/.code={
  87.             sudogetthisrow{#1}tempa
  88.             edeftempb{#2}
  89.             ifnumtempa=tempb
  90.             else
  91.                 defpgfmathresult{inf}
  92.             fi
  93.             message{^^Jtempa,tempb,pgfmathresult^^J}
  94.         }
  95.     }
  96. }
  97.      
  98. % These macros are-unfortunately- not accessable here. And the
  99. % worst is: error messages are impossible either because they are
  100. % not executed... try to provide useful hints:
  101. defthisrow##1{thisrow_unavailable_load_table_directly}%
  102. defthisrowno##1{thisrowno_unavailable_load_table_directly}%
  103. % this should work.
  104. defgetthisrow##1##2{pgfplotstablegetelem{coordindex}{##1}of{#3}{##2}}%
  105. defgetthisrowno##1##2{pgfplotstablegetelem{coordindex}{[index]##1}of{#3}{##2}}%
  106. %
  107.      
  108. documentclass{standalone}
  109.  
  110. usepackage{pgfplots}
  111. pgfplotsset{compat=newest}
  112.  
  113. usepackage{pgfplotstable}
  114. usepackage{filecontents}
  115.  
  116.  
  117. begin{filecontents}{fulltable.dat}
  118. houses  instance    value
  119. 20      1           8919
  120. 20      2           8965
  121. 20      3           8901
  122. 20      4           8816
  123. 20      5           8875
  124. 20      6           9027
  125. 20      7           8915
  126. 20      8           8907
  127. 20      9           8832
  128. 20      10          8934
  129. 200     1           84714
  130. 200     3           85630
  131. 200     4           84748
  132. 200     5           84565
  133. 200     6           85109
  134. 200     7           84588
  135. 200     8           84638
  136. 200     9           84673
  137. 200     10          85170
  138. end{filecontents}
  139.  
  140.  
  141. begin{document}
  142.  
  143. defthisrowunavailableloadtabledirectly{thisrow_unavailable_load_table_directly}
  144. defsudogetthisrow#1#2{
  145.     edef#2{thisrow{#1}}
  146.     ifx#2thisrowunavailableloadtabledirectly % if thisrow fails to get the element
  147.                             % then #2 is thisrow_unavailable_load_table_directlye
  148.                             % we have a backup
  149.         getthisrow{#1}{}
  150.         let#2=pgfplotsretval
  151.     fi
  152. }
  153.  
  154. pgfplotsset{
  155.     discard if not/.style 2 args={
  156.         x filter/.code={
  157.             sudogetthisrow{#1}tempa
  158.             edeftempb{#2}
  159.             ifnumtempa=tempb
  160.             else
  161.                 defpgfmathresult{inf}
  162.             fi
  163.             message{^^Jtempa,tempb,pgfmathresult^^J}
  164.         }
  165.     }
  166. }
  167.  
  168. pgfplotstableread{fulltable.dat}fulltable
  169.  
  170. begin{tikzpicture}[trim axis left]
  171.   begin{axis}[
  172.       title={{bfseries Plot for 20 houses instances}},
  173.       xlabel={Instance},
  174.       ylabel={Value}]
  175.     addplot+[only marks, discard if not={houses}{20}] table[x=instance, y=value]
  176.       {fulltable.dat};
  177.   end{axis}
  178. end{tikzpicture}
  179.  
  180. begin{tikzpicture}[trim axis left]
  181.   begin{axis}[
  182.       title={{bfseries Plot for 20 houses instances}},
  183.       xlabel={Instance},
  184.       ylabel={Value}]
  185.     addplot+[only marks, discard if not={houses}{20}] table[x=instance, y=value]
  186.       {fulltable};
  187.   end{axis}
  188. end{tikzpicture}
  189.  
  190. end{document}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top