[pstricks] Help needed twice with pst-bar

Herbert Voss Herbert.Voss at FU-Berlin.DE
Thu Mar 4 09:35:00 CET 2010


Am 03.03.2010 23:27, schrieb Ulrich Bongartz:
> I try to get some charts running but my patience is running out
> 
> 1) Source below works, but
> a) why arent the years under the bars?
> b) I'd like to put 2 more graphs in this diagram
> c) the values of each line should not be bars but a connected line

> \documentclass{article}
> \usepackage{filecontents}
> \usepackage{pst-bar}
> \usepackage{pstricks-add}
> \begin{filecontents*}{dev.csv}
> 2001 2002 2003 2004 2005 2006 2007 2008 2009
> 1 1 4 4 5 3 4 8 12

should be

2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
1, 1, 4, 4, 5, 3, 4, 8, 12

you can also use the plotstyle bar for your graph

\usepackage{filecontents}
\usepackage{pst-bar}
\usepackage{pstricks-add}
\begin{filecontents*}{dev.csv}
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
1, 1, 4, 4, 5, 3, 4, 8, 12
\end{filecontents*}
\begin{filecontents*}{dev2.csv}
2001 1 2002 2 2003 4 2004 4 2005 5 2006 3 2007 4 2008 8 2009 12
\end{filecontents*}
% 15 23 16 28 24 15 19 14 37
% 16 24 20 32 29 18 23 22 49 % sum of both lines

\begin{document}

\psset{xAxisLabel=Jahr,xAxisLabelPos={c,-0.3in},%
      yAxisLabel={Anzahl},yAxisLabelPos={-0.5in,c},axesstyle=frame}
\readdata{\data}{dev2.csv}
\pstScalePoints(1,1){2000.5 sub}{}
\begin{psgraph}[dy=5,Dy=5,Oy=0,Ox=2000,showorigin=false,labels=y,
ticks=y,yticksize=0 9](0,0)(9,50){9cm}{6cm}
\multido{\rA=0.5+1.0,\iB=2001+1}{9}{\uput[-90](\rA,0){\iB}}
\listplot[plotstyle=bar,fillcolor=blue!30,fillstyle=solid,barwidth=0.5]{\data}
\listplot[linestyle=dashed]{\data}
\end{psgraph}

\end{document}


> 2) Is there an easy way for a pie chart (30 red, 400 blue) where the
> small part is taken out of "the cake"? Or do I have to paint wedges?

read the documentation of pstricks-add => texdoc pstricks-add

Herbert


More information about the PSTricks mailing list