乳胶条形图

Sve*_*uem 3 latex pstricks bar-chart

我正在尝试使用LaTeX制作条形图.到目前为止,我一直没有成功,所以有人可以帮助我,也许是最近一个项目的副本?如何制作带有pstricks的条形图?我会很感激最简单的解决方案,因为我刚开始使用TeX.

就像在官方文件中提到的那样

这是我到目前为止:

\psset{unit=0.5in}%
\begin{pspicture}(0,-0.5)(3,3)%
\readpsbardata{\data}{example1.csv}%
\psbarchart[barstyle={red,blue}]{\data}%
\end{pspicture}
Run Code Online (Sandbox Code Playgroud)

Mat*_* B. 9

我强烈推荐使用PGF,TiKZ和PGFPlots的神奇组合.这些工具通常被接受为pstricks的替代品.它们与pdflatex和许多其他工具兼容,这会给pstricks带来麻烦.

这是高度语义的TeX源代码

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4} 

\begin{document}

\begin{tikzpicture}

\begin{axis}[%
scale only axis,
width=5in,
height=4in,
xmin=-3, xmax=3,
ymin=0, ymax=1,
axis on top]
\addplot[
  ybar,
  bar width=0.102874in, 
  bar shift=0in,
  fill=red,
  draw=black] 
  plot coordinates{ 
    (-2.9,0.00022263) (-2.7,0.000682328) (-2.5,0.00193045) (-2.3,0.00504176)
    (-2.1,0.0121552) (-1.9,0.0270518) (-1.7,0.0555762) (-1.5,0.105399)
    (-1.3,0.18452) (-1.1,0.298197) (-0.9,0.444858) (-0.7,0.612626)
    (-0.5,0.778801) (-0.3,0.913931) (-0.1,0.99005) (0.1,0.99005)
    (0.3,0.913931) (0.5,0.778801) (0.7,0.612626) (0.9,0.444858) 
    (1.1,0.298197) (1.3,0.18452) (1.5,0.105399) (1.7,0.0555762)
    (1.9,0.0270518) (2.1,0.0121552) (2.3,0.00504176) (2.5,0.00193045)
    (2.7,0.000682328) (2.9,0.00022263)
  };

\end{axis}
\end{tikzpicture}

\end{document}
Run Code Online (Sandbox Code Playgroud)

产量

条形图示例