Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{pgfplotstable}
  3.  
  4. pgfplotsset{compat=1.15}
  5.  
  6. begin{document}
  7. pgfplotstableread{
  8. x xmin xmax par1 y cat par2
  9. 0.5 0 1 yes 0.3 1 no
  10. 1.5 1 2 yes 0.6 1 no
  11. 2.5 2 3 yes 0.7 1 no
  12. 0.5 0 1 yes 0.4 2 no
  13. 1.5 1 2 yes 0.5 2 no
  14. 2.5 2 3 yes 0.9 2 no
  15. }data
  16.  
  17. pgfplotstableread{
  18. x xmin xmax par1 y cat par2
  19. 0.5 0 1 yes 0.3 1 no
  20. 1.5 1 2 yes 0.6 1 no
  21. 2.5 2 3 yes 0.7 1 no
  22. 2.5 3 3 yes 0.7 1 no
  23. }dataA
  24.  
  25. pgfplotstableread{
  26. x xmin xmax par1 y cat par2
  27. 0.5 0 1 yes 0.4 2 no
  28. 1.5 1 2 yes 0.5 2 no
  29. 2.5 2 3 yes 0.9 2 no
  30. 2.5 3 3 yes 0.9 2 no
  31. }dataB
  32.  
  33. begin{tikzpicture}
  34. begin{axis}[ybar, ymin=0, ymax=1, xmin=-0.5, xmax=3.5]
  35. addplot[black, ybar interval] table[x=xmin,y=y] {dataA}closedcycle;
  36. end{axis}
  37. end{tikzpicture}
  38.  
  39. begin{tikzpicture}
  40. begin{axis}[ybar, ymin=0, ymax=1, xmin=-0.5, xmax=3.5]
  41. addplot[black, ybar interval] table[x=xmin,y=y] {dataB}closedcycle;
  42. end{axis}
  43. end{tikzpicture}
  44.  
  45. end{document}
  46.  
  47. newcommand{filtertable}[2]{
  48. pgfplotstabletypeset[
  49. columns/par1/.style={string type},
  50. columns/par2/.style={string type},
  51. row predicate/.code={%
  52. pgfplotstablegetelem{##1}{cat}of{#1}
  53. ifnumpgfplotsretval=#2relax
  54. elsepgfplotstableuserowfalsefi}
  55. ]{#1}
  56. }
  57.  
  58. filtertable{data}{1}
  59. filtertable{data}{2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement