1

I am trying to reproduce the following figure using LaTeX

enter image description here

I have previously used PSTricks to make bar plots, but that was using only a single column - not multiple as in the figure. Does PStricks support multiple columns or is a solution with tikZ better for this case?

Here is the sample-data that the example-figure was produced with:

  0         1          2
0.0046    0.0041    0.0034
0.0228    0.0168    0.0115
0.0178    0.0119    0.0119
1

Like this, with pst-plot and pst-bar?

 \documentclass[border=3pt, svgnames]{standalone}
\pagestyle{empty}
\usepackage{pst-plot, pst-bar} %
\usepackage{auto-pst-pdf}

\newpsbarstyle{slategray}{fillcolor=SlateGrey!80, fillstyle = solid}

\begin{document}

\begin{postscript}%\psset{origin ={1,0}}
\psset{xAxisLabel=\sffamily k, yAxisLabel=\sffamily Axis 1,llx=-.5cm,lly=-1cm,ury=0.5cm,
xAxisLabelPos={c,-0.004},yAxisLabelPos={-0.8,c}}
%%%
\pslegend[rt](6,68){\black\rule[-0.5ex]{2em}{2ex} &\itshape first\\
\color{SlateGrey!80}\rule[-0.5ex]{2em}{2ex} & \itshape second\\%
\setlength\fboxsep{-0.6pt}%
\fbox{\white\rule[-0.5ex]{2em}{2ex}} & \itshape third}
%%%
 \begin{psgraph}[axesstyle=frame, labels = all, ticksize=4pt 0pt, Ox =-1,Dy=0.01](-0.5,0)(-0.5, 0)(4.5,0.03){8cm}{6cm}%
\psaxes[ticks=x, labels=none, ticksize=-4pt 0pt ,dx=2cm, yunit=10cm](4.5,0.03)(-0.5,0.03)
\psaxes[ticks=y, labels=y, ticksize=-4pt 0pt ,dy=2cm, Dy=0.2, ylabelPos=right, yunit=10cm](4.5,0)(4.5,0.6)
\uput{0.8}[r]{90}(4.5,0.015){\sffamily Axis 2}
 \readpsbardata{\data}{sample-data.csv}%
 \psset{barsep=0.08, barcolsep=0.25 ,barstyle={black, slategray, white}, yunit=200cm,}%
 \psbarchart{\data}%
\end{psgraph}
\end{postscript}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.