[pstricks] pstricks-add

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Wed Jul 7 08:27:27 CEST 2004


Alan Ristow wrote:

> Anyway, as an addendum to my last response, I spoke too soon about
> plotting more than one data set on the same axes with \psgraph. Since it
> contains a pspicture environment, only one dataset may be plotted at a
> time. This is a serious weakness, IMO. Fortunately, the problem seems to

yes, that is a good point.
I changed the \psgraph macro to an environment

\begin{psgraph}[<options>](xMin,xMax)(yMin,yMax){Dx}{Dy}{xlength}{ylength}
   \listplot[...]{...}
   \listplot[...]{...}
   \fileplot[...]{...}
   \dataplot[...]{...}
\end{psgraph}

or for the TeX-uesers \psgraph ... \endpsgraph, see example below,
which needs filecontents.sty, which allows to overwrites the
demo data files.

It also needs pstricks-add.tex, version 1.62. There are also the two
demo-files http://perce.de/LaTeX/pstricks-add

Herbert


\documentclass[a4paper]{article}
\usepackage{filecontents}
\begin{filecontents*}{demo1.dat}
   1989 3.08
   1990 3.84
   1991 4.08
   1992 3.21
   1993 5.23
   1994 2.97
   1995 2.53
   1996 2.8
   1997 2.78
   1998 3.15
   1999 2.32
   2000 2.4
   2001 2.46
\end{filecontents*}
\begin{filecontents*}{demo2.dat}
   1989 3.08
   1990 3.1
   1991 3.08
   1992 3.21
   1993 5.0
   1994 2.27
   1995 3.53
   1996 3.8
   1997 2.8
   1998 4.15
   1999 3.32
   2000 1.4
   2001 2.46
\end{filecontents*}

\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{pstricks-add}
\usepackage{pst-key}
\usepackage[margin=1.75cm]{geometry}
\pagestyle{empty}
\parskip=0pt

\begin{document}

\readdata{\dataI}{demo1.dat}%
\readdata{\dataII}{demo2.dat}%
\psset{xAxesLabel=Year,yAxesLabel=Whatever,%
    xAxesLabelPos={2in,-0.4in},yAxesLabelPos={-0.4in,1in}}
%
\begin{center}
   \begin{psgraph}[axesstyle=frame,Ox=1989](0,12)(0,6){1}{1}{4in}{2in}%
     \pstScalePoints(1,1){1989 sub}{}
     \listplot[linecolor=red,linewidth=2pt]{\dataI}
     \listplot[linecolor=blue,linewidth=2pt]{\dataII}
     \listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}
   \end{psgraph}

\vspace{2cm}
   \psset{xAxesLabel=Year,yAxesLabel=Whatever,%
      xAxesLabelPos={1in,-0.4in},yAxesLabelPos={-0.4in,0.5in}}
 
\begin{psgraph}[axesstyle=frame,Ox=1989,Dx=5,Dy=2](0,12)(0,6){1}{1}{2in}{1in}%
     \pstScalePoints(1,1){1989 sub}{}
     \listplot[linecolor=red,linewidth=1pt]{\dataI}
     \listplot[linecolor=blue,linewidth=1pt]{\dataII}
     \listplot[linecolor=cyan,linewidth=1pt,yunit=0.5]{\dataII}
   \end{psgraph}

\end{center}

\end{document}





-- 
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes




More information about the PSTricks mailing list