Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{pgfplots}pgfplotsset{compat=1.10}
- usepackage{pgfplotstable}
- begin{document}
- begin{figure}
- begin{footnotesize}
- pgfplotstableread[col sep=comma, header=true]{
- unit,min,max
- A,0,5.27
- B,0,1.07
- C,-0.55,0.54
- D,-0.58,0.48
- E,0,0.14
- F,-0.1,0.09
- G,-0.04,0.03
- }loadedtable
- {
- begin{tikzpicture}
- begin{axis}[
- name=popaxis,
- scale only axis,
- xbar,
- xmin=0,
- xmax=6,
- %xmajorgrids=true,
- %xbar=2pt,
- width=0.4*textwidth, height= 0.2*textheight,
- y dir = reverse,
- nodes near coords = {pgfmathprintnumberpgfplotspointmeta},
- every node near coord/.append style={/pgf/number format/fixed,
- font=footnotesize,
- color=black},
- xticklabel= {pgfmathprintnumbertick},
- y tick label style={text width=3cm,align=center},
- axis x line=left,
- axis y line=none,
- %
- enlarge x limits = {value=0.15,upper},
- axis line style={-},
- clip=false
- ]
- addplot[gray,fill=lightgray!50] table[y expr =coordindex, x expr={thisrow{max}}] loadedtable;
- pgfplotstablegetrowsof{loadedtable}
- pgfmathsetmacro{lastrow}{pgfplotsretval-1}
- end{axis}
- begin{axis}[
- at={(popaxis.north west)},anchor=north east, xshift=0.325cm,
- scale only axis,
- xbar = 0,
- xmin = -3,
- xmax = 0,
- %xmajorgrids=true,
- width=0.2*textwidth,
- height= 0.2*textheight,
- %x dir=reverse,
- y dir=reverse,
- nodes near coords = {pgfmathprintnumberpgfplotspointmeta},
- every node near coord/.append style={/pgf/number format/fixed, rotate = 0, anchor = east, font=footnotesize,
- color=black},
- xticklabel= {pgfmathprintnumbertick},
- axis x line=left,
- axis y line*=left,
- %
- ytick = data,
- yticklabels from table = {loadedtable}{unit},
- ytick align=center,
- ytick pos=left,
- enlarge x limits = {value=0.15,upper},
- axis line style={-}
- ]
- addplot[gray,fill=lightgray!50] table[y expr =coordindex, x expr={thisrow{min}}] loadedtable;
- end{axis}
- draw (0,0) -- (0,4);
- end{tikzpicture}
- }
- end{footnotesize}
- end{figure}
- begin{center}
- begin{figure}
- pgfplotstableread[col sep=comma, header=true]{
- unit,min,max
- A,77,86
- B,77,82
- C,74,80
- D,75,79
- E,77,78
- F,76,78
- G,76,78
- }loadedtable
- resizebox{10cm}{!}{%
- begin{tikzpicture}
- begin{axis}[
- name=popaxis,
- scale only axis,
- xbar,
- xmin=77,
- xmax=87,
- %xmajorgrids=true,
- %xbar=2pt,
- %xlabel={%},
- width=10cm, height=8cm,
- y dir = reverse,
- nodes near coords = {pgfmathprintnumberpgfplotspointmeta},
- every node near coord/.append style={/pgf/number format/fixed,
- font=small,
- color=black},
- xticklabel= {pgfmathprintnumbertick},
- y tick label style={text width=3cm,align=center},
- axis x line=left,
- axis y line=none,
- enlarge x limits = {value=0,upper},
- axis line style={-},
- clip=false
- ]
- addplot[gray,fill=lightgray!50] table[y expr =coordindex, x expr={thisrow{max}}] loadedtable;
- pgfplotstablegetrowsof{loadedtable}
- pgfmathsetmacro{lastrow}{pgfplotsretval-1}
- end{axis}
- begin{axis}[
- at={(popaxis.north west)},anchor=north east, xshift=0cm,
- scale only axis,
- xbar,
- allow reversal of rel axis cs=true,
- y dir=reverse,
- % x dir=reverse,
- %axis y line*=right,
- xmin=67,
- xmax=77,
- %xmajorgrids=true,
- width=10cm,
- height=8cm,
- nodes near coords = {pgfmathprintnumberpgfplotspointmeta},
- every node near coord/.append style={/pgf/number format/fixed, rotate = 0, anchor = east, font=footnotesize,
- color=black},
- xticklabel= {pgfmathprintnumbertick},
- axis x line=left,
- axis y line*=right,
- ytick = data,
- yticklabels from table = {loadedtable}{unit},
- ytick align=center,
- ytick pos=left,
- enlarge x limits = {value=0,upper},
- axis line style={-}
- ]
- addplot[gray,fill=lightgray!50] table[y expr =coordindex, x expr={thisrow{min}}] loadedtable;
- end{axis}
- draw (0,0) -- (0,8);
- end{tikzpicture}
- }
- end{figure}
- end{center}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement