Tuesday, May 22, 2012

Bar plots

In package pstricks-add (Maybe in a new version of pstrick this plotstyle have been moved to package pstrick) there is a new plotstyle named bar defined. Use this plotstyle a bar chart can be plotted easily. The parameters closely related to this plotstyle includes "barwidth","fillstyle" and so on. The usage of this plotstyle is very simple. Let us learn it by an example.

\documentclass{article}
\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage{pst-plot}
\begin{document}
  \begin{psgraph}(-1,0)(6,5){5cm}{5cm}
    \savedata{\mydata}[{0,1},{1,3},
      {2,2}{3,4},{4,1},{5,2}]
    \dataplot[linecolor=blue,plotstyle=bar,
      barwidth=0.5cm,fillcolor=red,
      fillstyle= solid]{\mydata}
  \end{psgraph}
\end{document} 

Fig.1 Bar plot using pstricks
Files Download: tex ps pdf

No comments:

Post a Comment

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.