Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{pgfplotstable}
- pgfplotsset{compat=1.15}
- begin{document}
- pgfplotstableread{
- x xmin xmax par1 y cat par2
- 0.5 0 1 yes 0.3 1 no
- 1.5 1 2 yes 0.6 1 no
- 2.5 2 3 yes 0.7 1 no
- 0.5 0 1 yes 0.4 2 no
- 1.5 1 2 yes 0.5 2 no
- 2.5 2 3 yes 0.9 2 no
- }data
- pgfplotstableread{
- x xmin xmax par1 y cat par2
- 0.5 0 1 yes 0.3 1 no
- 1.5 1 2 yes 0.6 1 no
- 2.5 2 3 yes 0.7 1 no
- 2.5 3 3 yes 0.7 1 no
- }dataA
- pgfplotstableread{
- x xmin xmax par1 y cat par2
- 0.5 0 1 yes 0.4 2 no
- 1.5 1 2 yes 0.5 2 no
- 2.5 2 3 yes 0.9 2 no
- 2.5 3 3 yes 0.9 2 no
- }dataB
- begin{tikzpicture}
- begin{axis}[ybar, ymin=0, ymax=1, xmin=-0.5, xmax=3.5]
- addplot[black, ybar interval] table[x=xmin,y=y] {dataA}closedcycle;
- end{axis}
- end{tikzpicture}
- begin{tikzpicture}
- begin{axis}[ybar, ymin=0, ymax=1, xmin=-0.5, xmax=3.5]
- addplot[black, ybar interval] table[x=xmin,y=y] {dataB}closedcycle;
- end{axis}
- end{tikzpicture}
- end{document}
- newcommand{filtertable}[2]{
- pgfplotstabletypeset[
- columns/par1/.style={string type},
- columns/par2/.style={string type},
- row predicate/.code={%
- pgfplotstablegetelem{##1}{cat}of{#1}
- ifnumpgfplotsretval=#2relax
- elsepgfplotstableuserowfalsefi}
- ]{#1}
- }
- filtertable{data}{1}
- filtertable{data}{2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement