From 4fc059d84872dabd58b4d041eeaa55e5669feef7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 19 Aug 2013 22:50:17 +0000 Subject: pst-plot (19aug13) git-svn-id: svn://tug.org/texlive/trunk@31473 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-plot/Changes | 1 + .../doc/generic/pst-plot/doc/dtk02-1.tex | 561 ++++++++++++++++ .../doc/generic/pst-plot/doc/dtk02-2.bib | 86 +++ .../doc/generic/pst-plot/doc/dtk02-2.tex | 375 +++++++++++ .../doc/generic/pst-plot/doc/pst-plot-doc.pdf | Bin 1194030 -> 1194031 bytes .../doc/generic/pst-plot/doc/tugboat01-4.bib | 120 ++++ .../doc/generic/pst-plot/doc/tugboat01-4.tex | 705 +++++++++++++++++++++ 7 files changed, 1848 insertions(+) create mode 100644 Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-1.tex create mode 100644 Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.bib create mode 100644 Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.tex create mode 100644 Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.bib create mode 100644 Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.tex (limited to 'Master/texmf-dist/doc/generic/pst-plot') diff --git a/Master/texmf-dist/doc/generic/pst-plot/Changes b/Master/texmf-dist/doc/generic/pst-plot/Changes index 245c85c7d4f..925e55e9a79 100644 --- a/Master/texmf-dist/doc/generic/pst-plot/Changes +++ b/Master/texmf-dist/doc/generic/pst-plot/Changes @@ -1,4 +1,5 @@ ----- pst-plot.tex +1.49 2013-08-17 - fix introduced bug in \get@label 1.48 2013-08-10 - allow x|ylabelOffset also for special Labels 1.47 2013-07-08 - added \psreadColumnData 1.46 2013-06-10 - fix bug with missing \relax in \get@label diff --git a/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-1.tex b/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-1.tex new file mode 100644 index 00000000000..1ca703b0c6c --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-1.tex @@ -0,0 +1,561 @@ +\documentclass[ngerman,12]{dtk} +\begin{filecontents*}{\jobname} +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {PostScript richtig eingesetzt: vom Konzept zum + praktischen Einsatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for Generic TeX}, + Author = {Timothy Van Zandt}, + Organization = {}, + Address = {}, + Note = {\url{http://www.tug.org/application/PSTricks}}, + year = 1993, +} +\end{filecontents*} +\NeedPackage{pst-plot} +\NeedPackage{url} +\NeedPackage{longtable} +%\makeatletter +%\newcommand{\La}% +% {L\kern-.36em +% {\setbox0\hbox{T}% +% \vbox to\ht0{\hbox{$\m@th$% +% \csname S@\f@size\endcsname +% \fontsize\sf@size\z@ +% \math@fontsfalse\selectfont +% A}% +% \vss}% +% }} +%\newcommand\AllTeX{(\La\kern-.075em)\kern-.075em\TeX} +%\makeatother + +\title{Die mathematischen Funktionen von Postscript} +\author{Herbert Voß} +\address{Herbert}{Voß}{Wasgenstr. 21\\14129 Berlin\\voss@perce.de} +\maketitle +\begin{abstract} + \PS, faktisch genauso alt wie \TeX, ist im Verhältnis dazu allgemein + noch weniger bekannt, wenn es darum geht zu beurteilen, was es denn + nun im eigentlichen Sinne ist. Außerdem wird häufig vergessen, dass + sich mit den \PS-Funktionen viele Dinge erledigen lassen, bei denen + sonst auf externe Programme zurückgegriffen wird. Dies wird im + Folgenden für die mathematischen Funktionen im Zusammenhang mit dem + Paket \texttt{pst-plot} gezeigt. +\end{abstract} + +\section{Einführung} + +\PS, sehr häufig nur als Druckertreiber bekannt oder im Zusammenhang +damit als Seitenbeschreibungssprache, ist ähnlich wie \TeX{} eine +Programmiersprache, wobei \PS\ eindeutig als sogenannte Hochsprache +bezeichnet werden muss.\cite{PostScript} Während die Ursprünge der +Entwicklung bis in die Anfänge der siebziger Jahre zurückgehen, datiert +die erste veröffentlichte \PS-Version von 1982, was nicht zufällig +das Jahr der Gründung von \emph{Adobe System Incorporated} ist. Der +erste Laserdrucker mit vollständiger \PS-Implementierung war der +\emph{Apple Laserwriter}. Der einzige Computer, der \PS\ auch für +die Bildschirmausgabe (Display \PS) verwendet, ist \emph{Next}. + + +\section{\PS-Befehle} + +\PS~arbeitet mit dem so genannten Stack-System, welches den Benutzern +von HP-Taschenrechnern geläufig und auch unter dem Namen \emph{UPN}, +\emph{Umgekehrte Polnische Notation} (Reverse Polish Notation), bekannt +ist und letztlich den internen Standard für alle Computer darstellt. +Die normale Notation für die Multiplikation "`$a*b=$"' wird zu +"`$a$$b$*"'. Es sind immer zuerst die Parameter +(Variablen) auf dem Stack abzulegen (durch symbolisiert), +bevor eine der mathematischen Funktionen aufgerufen wird. Die hier +beschriebenen Befehle beziehen sich immer auf das oberste Stack-Element +oder die obersten beiden Stack-Elemente. + +Die direkte Anwendung der \PS-Befehle für die Darstellung +mathematischer Zusammenhänge bringt gegenüber Programmen wie +beispielsweise \texttt{gnuplot} nicht immer Vorteile in der +endgültigen Druckausgabe. Auch lässt sich nicht unbedingt jedes +mathematische Problem mit den \PS-Befehlen einfach lösen. Vorteile +ergeben sich durch die Übersichtlichkeit und vor allen Dingen in der +Länge der Textdateien. + + +\section{Anwendung mit pst-plot} + +Das umfangreiche Paket \texttt{pstricks} (\url{CTAN:/graphics/pstricks/}) +ist nichts weiter als ein Frontend für \LaTeXTeX\ zu den \PS-Funktionen. +Das Paket \texttt{pst-plot} (\url{CTAN:/graphics/pstricks/latex/pst-plot.sty}), +welches Teil des Pakets \texttt{pstricks} ist, ermöglicht mit zwei +Befehlen die Anwendung der \PS-Funktionen für das Zeichnen von mathematischen +Funktionen. Mit der Anweisung \texttt{\textbackslash{}usepackage\{pst-plot\}} +wird automatisch das übergeordnete Paket \texttt{pstricks} geladen. + +Die grundsätzliche Struktur der hier behandelten Befehle ist: + +\begin{verbatim} +\psplot[Parameter]{xmin}{xmax}{Funktion f(x)} +\parametricplot[Parameter]{tmin}{tmax}{Funktionen x(t), y(t)} +\end{verbatim} + +Hierin bedeuten $\left[x_{min};\ x_{max}\right]$ und $\left[t_{min};\ + t_{max}\right]$ das jeweilige Definitionsintervall (Start- und +Endwert). Die möglichen Parameter können der Dokumentation zu +\texttt{pstricks} entnommen werden, die zwar schon älteren Datums ist, +jedoch völlig ausreicht \cite{pstricks}. Hier ist im +Zusammenhang mit den Funktionen lediglich der Parameter +\texttt{plotpoints} interessant, welcher die Anzahl der Stützstellen +angibt und standardmäßig auf 50 gesetzt ist. Sämtliche berechneten +Punkte werden intern mit \texttt{\textbackslash{}psline} verbunden, so +dass sich eine zu geringe Anzahl an Stützstellen durch einen +Polygonzug bemerkbar macht. Mit Werten um $200$ liegt man in den +meisten Fällen auf der richtigen Seite. In diesem Zusammenhang ist +unbedingt zu beachten, dass geänderte Parameter so lange ihren Wert +behalten, bis innerhalb eines \LaTeX{}-Laufs eine neue Wertzuweisung +erfolgt. + +Der Variablenname für \texttt{psplot} ist per Definition $x$ und +für \texttt{parametricplot} $t$. Beide können nicht verändert werden, +was jedoch bezüglich der Anwendung keinerlei Einschränkung darstellt. +Die Variablen können beliebig oft innerhalb eines Ausdrucks verwendet +werden, denn erst mit der schließenden Klammer für den Funktionsausdruck +wird davon ausgegangen, dass die zweite Koordinate für einen Punkt +des Graphen oben auf dem Stack liegt. Der einzige Unterschied zwischen +diesen beiden Befehlen ist, dass bei \texttt{psplot} nur der oberste +Stack-Wert ($y$) und bei \texttt{parametricplot} die obersten beiden +Stack-Werte ($x;y$) als Argumente verwendet werden. + +Zu beachten ist unbedingt, dass mit den beiden Befehlen keine +Fehlermeldungen ausgegeben werden, was insbesondere für diejenigen +mathematischen Funktionen von Interesse ist, deren Definitionsbereich +nicht ganz $\Re $ entspricht. Denn bei \emph{einem} fehlerhaften +Argument, beispielsweise $\sqrt{-1}$, wird der komplette Graph nicht +gezeichnet! + +Der Vollständigkeit halber sei erwähnt, dass \texttt{pst-plot} noch +weitere drei Befehle zum Zeichnen von Funktionsgraphen zur Verfügung +stellt, die jedoch alle externe Datensätze voraussetzen: + +\begin{quote} +\verb|\fileplot[|\var{Parameter}\verb|]{|\var{Dateiname}\verb|}|\\ +\verb|\dataplot[|\var{Parameter}\verb|]{|\var{Befehle}\verb|}|\\ +\verb|\listplot[|\var{Parameter}\verb|]{|\var{Liste}\verb|}| +\end{quote} + +Weitere Informationen kann man der Dokumentation zu \texttt{pstricks} +entneh\-men \cite{pstricks}. + + +\section{Beispiele für \texttt{\textbackslash{}psplot}} + +Für alle Beispiele wird jeweils die komplette +\texttt{pspicture}-Umgebung angegeben, sodass eine direkte Übernahme +der Beispiele möglich ist. Eine Dokumentation des +\texttt{multido}-Befehls findet man unter \url{CTAN: + /macros/latex209/contrib/multido/multido.doc}, alle anderen in der +Dokumenation zu \texttt{pstricks} \cite{pstricks}. + +\subsection{Sinusfunktion} + +\begin{tabular}{ll}\toprule +Funktion &\PS \\\midrule +$y(x)=\sin x$&\tt x sin \\\bottomrule +\end{tabular} + +\begin{minipage}[c]{5.25cm}% +\psset{xunit=0.0111cm,yunit=1cm}% +\begin{pspicture}(-20,-1.25)(400,1.25)% +\psline[linewidth=1pt]{->}(-20,0)(400,0)% +\psline[linewidth=1pt]{->}(0,-1.25)(0,1.25)% +\multido{\n=+90}{5}{\psline[linestyle=dotted]% + (\n,-1.25)(\n,1.25)\rput(\n,-0.25){\scriptsize{\n}}} +\multido{\n=-1+1}{3}{\psline[linestyle=dotted]% + (0,\n)(405,\n)\rput[r](-4,\n){\scriptsize{\n}}} +\psplot[plotstyle=curve,linewidth=1.5pt]{-20}{400}{x sin}% postscriptfunction +\rput[l](-5,1.75){$\mathbf{y}$}% +\rput[l](390,-.25){$\mathbf{x}$}% +\rput[l](180,0.75){$y=\sin x$}% +%rput[l](1.57,-0.25){$\frac{\pi}{2}$}% +\end{pspicture} +\end{minipage}% +\hfill +\begin{minipage}[c]{0.50\columnwidth}% +\scriptsize +\begin{verbatim} +\psset{xunit=0.0111cm,yunit=1cm} +\begin{pspicture}(-20,-1.25)(400,1.25) +\psline[linewidth=1pt]{->}(-20,0)(400,0) +\psline[linewidth=1pt]{->}(0,-1.25)(0,1.25) +\multido{\n=+90}{5}{\psline[linestyle=dotted]% + (\n,-1.25)(\n,1.25)\rput(\n,-0.25)% + {\scriptsize \n}} +\multido{\n=-1+1}{3}{\psline[linestyle=dotted]% + (0,\n)(405,\n)\rput[r](-4,\n){\scriptsize \n}} +\psplot[plotstyle=curve,linewidth=1.5pt]% + {-20}{400}{x sin}% postscript function +\rput[l](-5,1.75){$\mathbf{y}$} +\rput[l](390,-.25){$\mathbf{x}$} +\rput[l](180,0.75){$y=\sin x$} +\end{pspicture} +\end{verbatim} +\end{minipage}% + +\subsection{Potenzfunktion} + +Dargestellt wird eine Parabel dritten Grades sowie ihre +Umkehrfunktion, wobei die Intervallunterscheidung nicht zwingend ist, +wenn man die Exponentialschreibweise mit $y=x^{-\frac{1}{3}}$ wählt. + +\begin{tabular}{p{4.5cm}p{3cm}}\toprule +Funktion&\PS\\\midrule +$y(x)=x^{3}$ + +$y^{-1}(x)=\left\{ \begin{array}{cc} + +\sqrt[3]{\left|x\right|} & x>0\\ + -\sqrt[3]{\left|x\right|} & x<0\\ \end{array} +\right.$& +\parbox[t]{3cm}{\tt x 3 exp \\ +x 0.333 exp + +\rm (Umkehrfunktion)}\\\bottomrule +\end{tabular} + +\begin{minipage}[c]{5.5cm}% +\begin{pspicture}(-2.5,-2.5)(2.5,2.5)% +\psset{xunit=0.75cm,yunit=0.75cm} +\psgrid[subgriddiv=1,griddots=10,gridlabels=7pt](-3,-3)(3,3) +\psline[linewidth=1pt]{->}(-3,0)(3,0) +\psline[linewidth=1pt]{->}(0,-3)(0,3) +\psline[linewidth=0.5pt,linestyle=dotted](-3,-3)(3,3) +\psplot[plotstyle=curve,linewidth=1.5pt]{-1.45}{1.45}{x 3 exp}% postscript function +\psplot[plotstyle=curve,linewidth=1.5pt, linestyle=dashed]% + {0}{3}{x 0.333 exp}% postscript function +\psplot[plotstyle=curve,linewidth=1.5pt, linestyle=dashed]% + {-3}{0}{x -1 mul 0.333 exp -1 mul}% postscript function +\rput[l](-.25,3.25){$\mathbf{y}$} +\rput[l](3.25,-.25){$\mathbf{x}$} +\rput[l](1.5,2.5){$y=x^3$} +\rput[l](1.25,0.5){$y=+\sqrt[3]{|x|}$} +\rput[r](-1.25,-0.5){$y=-\sqrt[3]{|x|}$} +\end{pspicture}\end{minipage}% +\begin{minipage}[c]{0.50\columnwidth}% +\scriptsize\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psgrid[subgriddiv=1,griddots=10,% + gridlabels=7pt](-3,-3)(3,3)% +\psline[linewidth=1pt]{->}(-3,0)(3,0)% +\psline[linewidth=1pt]{->}(0,-3)(0,3)% +\psline[linewidth=0.5pt,linestyle=dotted]% + (-3,-3)(3,3)% +\psplot[plotstyle=curve,linewidth=1.5pt]% + {-1.4}{1.4}{x 3 exp}% postscript function +\psplot[plotstyle=curve,linewidth=1.5pt,% + linestyle=dashed]{0}{3}{x 0.333 exp} +\psplot[plotstyle=curve,linewidth=1.5pt,% + linestyle=dashed]{-3}{0}% + {x -1 mul 0.333 exp -1 mul} +\rput[l](-.25,3.5){$\mathbf{y}$}% +\rput[l](3.5,-.25){$\mathbf{x}$}% +\rput[l](1.5,2.5){$y=x^3$}% +\rput[l](1.25,0.5){$y=+\sqrt[3]{|x|}$}% +\rput[r](-1.25,-0.5){$y=-\sqrt[3]{|x|}$} +\end{pspicture} +\end{verbatim} +\end{minipage}% + + +\subsection{Beispiel aus der Leistungselektronik} + +Gezeigt wird die graphische Darstellung des relativen Strommittelwertes +für eine Stromrichtersteuerung durch ein Thyristorpaar. Hierbei entspricht +der Parameter $\varphi $ der Phasenverschiebung zwischen Strom und +Spannung. Die unabhängige Variable $\alpha $ bezeichnet den Steuerwinkel. + +\begin{tabular}{ll}\toprule +Funktion& +$\displaystyle \frac{I(\alpha )}{I_{0}}=\left\{ \begin{array}{ll} + \sqrt{1-\frac{\alpha }{\pi }+\frac{1}{2\pi }\sin 2\alpha } & \varphi =0\\ + & \\ + \sqrt{\left(2-\frac{2\alpha }{\pi }\right)\left(2+\cos 2\alpha +\right)+\frac{3}{\pi }\sin 2\alpha } & \varphi =\frac{\pi }{2}\\ \end{array} +\right.$\smallskip{} +\\ +\hline +\PS& +\begin{tabular}{p{7.5cm}l} +\tt 1 x 180 div sub 1 6.28 div x 2 mul sin mul add sqrt& +$\varphi =0$\\ +%\hline +\tt 2 x 90 div sub x 2 mul cos 2 add mul x 2 mul sin 3 3.15 div mul add +sqrt& +$\varphi =\frac{\pi }{2}$\\ +\end{tabular}\\\bottomrule +\end{tabular} + +Zu beachten ist, dass \PS~die Argumente für die trigonometrischen +Funktionen im Gradmaß erwartet, sodass für relative Winkel auf gleiche +Einheiten zu achten ist. Der Ausdruck $\frac{\alpha }{\pi }$ ist +daher durch $\frac{\alpha }{180}$ zu ersetzen. + +\begin{minipage}[c]{6.5cm}% +\begin{center}\psset{xunit=0.0275cm,yunit=4cm} +\begin{pspicture}(0,-0.25)(190,1.25) +\psline[linewidth=1pt]{->}(0,0)(190,0) +\psline[linewidth=1pt]{->}(0,0)(0,1.15) +\multido{\n=30+30}{6}{\psline[linestyle=dotted](\n,0)(\n,1)\rput(\n,-0.05){\scriptsize{\n}}} +\multido{\n=0.2+0.2}{5}{\psline[linestyle=dotted](0,\n)(180,\n)\rput[r](-4,\n){\scriptsize{\n}}} +\psplot[plotstyle=curve,linewidth=1.5pt]{0}{180}% +{1 x 180 div sub 1 6.28 div x 2 mul sin mul add sqrt}% postscriptfunction +\psplot[plotstyle=curve,linewidth=1.5pt,linestyle=dashed]{90}{180}% +{2 x 90 div sub x 2 mul cos 2 add mul x 2 mul sin 3 3.15 div mul add sqrt}% postscriptfunction +\rput(0,1.2){$\mathbf{I/I_0}$} +\rput[l](190,-.05){$\mathbf{\alpha}$} +\rput(45,0.85){$\varphi=0$} +\rput(120,0.9){$\varphi=90°$} +\end{pspicture}\end{center}\end{minipage}% +\begin{minipage}[c]{0.50\columnwidth}% +\scriptsize +\begin{verbatim} +\psset{xunit=0.0333cm,yunit=3cm} +\begin{pspicture}(0,-0.25)(190,1.25) +\psline[linewidth=1pt]{->}(0,0)(190,0) +\psline[linewidth=1pt]{->}(0,0)(0,1.15) +\multido{\n=30+30}{6}{\psline[% + linestyle=dotted](\n,0)(\n,1)% + \rput(\n,-0.05){\scriptsize \n}} +\multido{\n=0.2+0.2}{5}{\psline[% + linestyle=dotted](0,\n)(180,\n)% + \rput[r](-4,\n){\scriptsize \n}} +\psplot[plotstyle=curve,% + linewidth=1.5pt]{0}{180}% + {1 x 180 div sub 1 6.28 % + div x 2 mul sin mul add sqrt} +\psplot[plotstyle=curve,% + linewidth=1.5pt,linestyle=dashed]% + {90}{180}{2 x 90 div sub x 2 mul cos% + 2 add mul x 2 mul sin 3 3.15% + div mul add sqrt} +\rput(0,1.2){$\mathbf{I/I_0}$} +\rput[l](190,-.05){$\mathbf{\alpha}$} +\rput(45,0.85){$\varphi=0$} +\rput(120,0.9){$\varphi=90°$} +\end{verbatim} +\end{minipage}% + + +\renewcommand{\arraystretch}{1.0} + + +\section{Beispiele für \texttt{\textbackslash{}parametricplot}} + + +\subsection{Lissajous-Figur} + +Die aus der Physik oder Elektrotechnik bekannten Lissajous-Figuren sind +ein typischer Anwendungsfall für Gleichungen in Parameterform. Die +hier angegebene Darstellung beruht auf den Funktionen: + +\begin{tabular}{cl}\toprule +Funktion& +\PS\\\midrule +$x=\sin 1.5t$&\tt +t 1.5 mul sin\\ +%\hline +$y=\sin \left(2t+\frac{\pi }{3}\right)$&\tt +t 2 mul 60 add sin\\\bottomrule +\end{tabular} + +\begin{minipage}[c]{4cm}% +\begin{center}\psset{xunit=1.5cm,yunit=1.5cm} +\begin{pspicture}(-1.1,-1.1)(1.1,1.1) +\psgrid[subgriddiv=0,griddots=10,gridlabels=7pt](-1,-1)(1,1) +\parametricplot% + [plotstyle=curve,linewidth=1.5pt,plotpoints=200]% + {-360}{360}% + {t 1.5 mul sin t 2 mul 60 add sin} +\end{pspicture}\end{center}\end{minipage}% +\hfill{}\begin{minipage}[c]{0.75\columnwidth}% +\scriptsize +\begin{verbatim} +\psset{xunit=1.5cm,yunit=1.5cm} +\begin{pspicture}(-1,-1)(1,1) +\psgrid[subgriddiv=0,griddots=10,gridlabels=7pt]% + (-1,-1)(1,1) +\parametricplot[plotstyle=curve,linewidth=1.5pt,% + plotpoints=200]{-360}{360}{% + t 1.5 mul sin t 2 mul 60 add sin} +\end{pspicture} +\end{verbatim} +\end{minipage}% + + +Aufgrund der "`Länge"' des Graphen wurde der Wert für +\texttt{plotpoints} auf $200$ gesetzt, sodass auch die "`Ecken"' des +Graphen mit starker Krümmung kontinuierlich erscheinen. + + +\subsection{Strophoide} + +Zum Schluss wird eine sogenannte Strophoide dargestellt, die durch +folgende Beziehungen gegeben ist, wobei $a$ durch einen Zahlenwert +ersetzt werden muss: + +\def\arraystretch{1.2} + +\begin{tabular}{cl}\toprule +Funktion& +\PS\\ +\midrule +$x(t)=\frac{\displaystyle a\left(t^{2}-1\right)}{\displaystyle t^{2}+1}$&\tt +t t mul 1 sub $a$ mul t t mul 1 add div\\ +%\hline +$y(t)=\frac{\displaystyle at\left(t^{2}-1\right)}{\displaystyle t^{2}+1}$&\tt +t t mul 1 sub t mul $a$ mul t t mul 1 add div \\\bottomrule +\end{tabular} + +\begin{minipage}[c]{4cm}% +\begin{center}\psset{xunit=2cm,yunit=2cm} +\begin{pspicture}(-1.25,-1.25)(1.25,1.25) +\psgrid[subgriddiv=1,griddots=10,gridlabels=7pt](-1,-1)(1,1) +\parametricplot% + [plotstyle=curve,plotpoints=200,linewidth=1.5pt]{-1.85}{1.85}% + {t t mul 1 sub t t mul 1 add div % a=1 + t t mul 1 sub t mul t t mul 1 add div} +\parametricplot[plotstyle=curve,plotpoints=200,% + linewidth=1.5pt, linestyle=dashed]{-4.5}{4.5}% + {t t mul 1 sub 0.25 mul t t mul 1 add div % a=0.25 + t t mul 1 sub t mul 0.25 mul t t mul 1 add div} +\parametricplot[plotstyle=curve,plotpoints=200,% + linewidth=1.5pt, linestyle=dotted]{-2.1}{2.1}% + {t t mul 1 sub 0.75 mul t t mul 1 add div % a=0.75 + t t mul 1 sub t mul 0.75 mul t t mul 1 add div} +\rput[l](-0.95,-0.4){$\scriptstyle a=1;\ 0.75;\ 0.25$} +\end{pspicture}\end{center}\end{minipage}% +\hfill{}\begin{minipage}[c]{0.57\columnwidth}% +\scriptsize +\begin{verbatim} +\psset{xunit=2cm,yunit=2cm} +\begin{pspicture}(-1.25,-1.25)(1.25,1.25) +\psgrid[subgriddiv=1,griddots=10,% + gridlabels=7pt](-1,-1)(1,1) +\parametricplot[plotstyle=curve,plotpoints=200,% + linewidth=1.5pt]{-1.85}{1.85}% + {t t mul 1 sub t t mul 1 add div % a=1 + t t mul 1 sub t mul t t mul 1 add div} +\parametricplot[plotstyle=curve,plotpoints=200,% + linewidth=1.5pt, linestyle=dashed]{-5}{5}% + {t t mul 1 sub 0.25 mul t t mul 1 add div % + t t mul 1 sub t mul 0.25 mul t t mul 1 add div} +\parametricplot[plotstyle=curve,plotpoints=200,% + linewidth=1.5pt, linestyle=dashed]{-1}{1}% + {t t mul 1 sub 0.75 mul t t mul 1 add div % + t t mul 1 sub t mul 0.75 mul t t mul 1 add div} +\rput[l](-0.95,-0.4){$\scriptstyle % + a=1;\ 0.75;\ 0.25$} +\end{pspicture} +\end{verbatim} +\end{minipage}% + + +\appendix + +\section{Zusammenstellung der mathematischen \PS-Funktionen} + +Die folgende tabellarische Zusammenstellung enthält bis auf die +Matrizenbefehle alle mathematischen Funktionen mit ihren +Eigenschaften. Hierin sind \emph{} und \emph{} die +bekannten Integer und Reals, während für \emph{} jeder +beliebige Typ und für \emph{} \emph{real} oder \emph{integer} +gesetzt werden kann. Unabhängig von der Null gelten für Zahlen unter +\PS\ die folgenden Grenzen, wobei die Angaben für \emph{real} +betragsmäßig zu verstehen sind. + +\begin{tabular}{lcc}\toprule +& +\emph{integer}& +\emph{real}\\ +\hline +kleinster Wert& +$-2^{32}$& +$\pm 10^{-38}$\\ +größter Wert& +$2^{32}-1$& +$\pm 10^{38}$\\\bottomrule +\end{tabular} + +\begingroup +\def\arraystretch{1.1}% +\begin{longtable}{p{10.5mm}p{26mm}p{36mm}p{28mm}} +\toprule +\textit{Name}& +\textit{Bedeutung}& +\textit{Anwendung}& +\textit{Beispiel}\\\midrule +\endhead +abs&Absolutwert& abs&$-3$~abs~$\rightarrow 3$ \\ +%\hline +add&Addition\footnotemark& add&$5$~$7$~add~$\rightarrow 12$\\ +%\hline +atan&Arcus Tangens\footnotemark& atan&$2$~$45$~atan$\rightarrow 2.54$\\ +%\hline +cos&Cosinus\footnotemark& cos&$60$~cos$\rightarrow 0.5$\\ +%\hline +cvi&Real$\rightarrow $Integer& cvi&$14.13$~cvi$\rightarrow 14$\\ +%\hline +cvr&Integer$\rightarrow $Real& cvr&$14$~cvr$\rightarrow 14.00$\\ +%\hline +div&Division\footnotemark& div&$100\ 8$~div$\rightarrow 12.5$\\ +%\hline +dup&\raggedright Dupliziere oberstes Stack-Element& dup&$12$~dup$\rightarrow 12\ 12$\\ +%\hline +exch&Exchange\footnotemark& exch&$12\ 13$~exch$\rightarrow 13\ 12$\\ +%\hline +exp&Potenz& exp&$3\ 4$~exp$\rightarrow 81.0$\\ +%\hline +idiv&\raggedright ganzzahlige Division& idiv&$100\ 8$~idiv$\rightarrow 12$\\ +%\hline +ln&\raggedright natürlicher Logarithmus& ln&$12$~ln$\rightarrow 2.48491$\\ +%\hline +log &Zehner-Logarithmus & log&$1000$~log$\rightarrow 3.00$\\ +%\hline +mod &Modulo& mod&$5\ 3\ $mod$\rightarrow 2$\\ +%\hline +mul &Multiplikation$^{1}$ & mul&$5\ 3\ $mul$\rightarrow 15$\\ +%\hline +neg &\raggedright Negiere Vorzeichen& neg&$5\ $neg$\rightarrow -5$\\ +%\hline +round &Runden& round&$5.7\ $round$\rightarrow 6$\\ +%\hline +sin &Sinus$^{3}$& sin&$30$~sin$\rightarrow 0.5$\\ +%\hline +sqrt &Quadratwurzel& sqrt&$16$ sqrt$\rightarrow 4.0$\\ +%\hline +sub &Subtraktion$^{1}$& sub&$17\ 19\ $sub$\rightarrow -2$\\ +%\hline +truncate&Dezimalteil abtrennen\footnotemark& truncate&$-33.33\rightarrow 33.00\ $\\\bottomrule +\end{longtable} + +\small\parskip=1pt +Anmerkungen: + +$^{1}$ Sind beide Argumente ganze Zahlen ist auch das Ergebnis vom +Typ Integer. + +$^{2}$ Entspricht der Darstellung $\alpha = +\textrm{arctan}\displaystyle \frac{}{}$. + +$^{3}$ Das Argument wird im Gradmaß erwartet. + +$^{4}$ Das Ergebnis ist grundsätzlich vom Typ \emph{real}. + +$^{5}$ Die Anordnung der letzten beiden Stack-Elemente wird vertauscht. + +$^{6}$ Das Ergebnis bleibt vom Typ \emph{real}. +\endgroup + +\bibliography{\jobname} +\end{document} diff --git a/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.bib b/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.bib new file mode 100644 index 00000000000..f27916c11eb --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.bib @@ -0,0 +1,86 @@ +%% -*-bibtex-*- +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten + \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Article{ dtk02.1:voss:mathematischen, + author = {Herbert Vo{\ss}}, + title = {Die mathematischen Funktionen von Postscript}, + journal = dtk, + year = 2002, + volume = {1/02}, + altvolume = 1, + altnumber = 14, + month = mar, + pages = {}, + annote = bretter, + keywords = {}, + abstract = { \PS, faktisch genauso alt wie {\TeX}, ist im + Verh{\"a}ltnis dazu allgemein noch weniger bekannt, wenn es + darum geht zu beurteilen, was es denn nun im eigentlichen + Sinne ist. Au{\ss}erdem wird h{\"a}ufig vergessen, dass + sich mit den \PS-Funktionen viele Dinge erledigen lassen, + bei denen sonst auf externe Programme zur{\"u}ckgegriffen + wird. Dies wird im Folgenden f{\"u}r die mathematischen + Funktionen im Zusammenhang mit dem Paket \texttt{pst-plot} + gezeigt. } +} + +@Book{ companion, + author = {Michel Goosens and Frank Mittelbach and Alexander + Samarin}, + title = {The {\LaTeX} Graphics Companion}, + publisher = {Addison-Wesley Publishing Company}, + year = {1997}, + address = {Reading, Mass.} +} + +@Article{ girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de PSTricks}, + journal = {Cahier GUTenberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{ girou:02:, + author = {Timothy van Zandt and Denis Girou}, + title = {Inside PSTricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {PostScript richtig eingesetzt: vom Konzept zum + praktischen Einsatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for Generic TeX}, + Author = {Timothy van Zandt}, + Organization = {}, + Address = {http://www.tug.org/application/PSTricks}, + Note = {}, + year = 1993 +} + diff --git a/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.tex b/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.tex new file mode 100644 index 00000000000..353db1f24f8 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-plot/doc/dtk02-2.tex @@ -0,0 +1,375 @@ +\documentclass[ngerman]{dtk} +\usepackage[T1]{fontenc} +\usepackage[latin1]{inputenc} +%\usepackage{pslatex} +\usepackage{tabularx} +\usepackage{url} +\usepackage{graphicx} +\usepackage{cite} +%\makeatletter +%\newcommand{\La}% +% {L\kern-.36em +% {\setbox0\hbox{T}% +% \vbox to\ht0{\hbox{$\m@th$% +% \csname S@\f@size\endcsname +% \fontsize\sf@size\z@ +% \math@fontsfalse\selectfont +% A}% +% \vss}% +% }} +%\makeatother +%\def\AllTeX{(\La\kern-.075em)\kern-.075em\TeX} + +\begin{document} +\NeedPackage{tabularx} +\NeedPackage{url} +\NeedPackage{graphicx} +\NeedPackage{cite} + + +\title{Die Plot-Funktionen von \texttt{pst-plot}} +\author{Laura E. Jackson\and Herbert Voß} +\maketitle +\begin{abstract} + Im letzten Heft wurden die mathematischen Funktionen von \PS~im + Zusammenhang mit dem \LaTeX-Paket \texttt{pst-plot} zum Zeichnen von + Funktionen beschrieben und durch Beispiele erläutert. In diesem Teil + werden die bislang nur erwähnten Plot-Funktionen für externe Daten + behandelt. +\end{abstract} + +\section{Einführung} +Die graphische Darstellung externer Datensätze gehört zu den +Standardproblemen von technisch-wissenschaftlichen Veröffentlichungen. +Sehr häufig werden diese mit \texttt{gnuplot} eingelesen, dargestellt, +mit Koordinatenachsen und weiteren Hinweisen versehen und dann +abschließend nach \LaTeX\ exportiert. Im Folgenden werden Wege +aufgezeigt, die den Umweg über \texttt{gnuplot} oder entsprechende +Programme überflüssig machen können. + +Die Geschichte und die Bedeutung von \PS\ wurden hinreichend im +letzten Heft \cite{dtk02.1:voss:mathematischen} behandelt, ebenso wie +das benötigte Paket \texttt{pst-plot} +(\url{CTAN:/graphics/pstricks/latex/pst-plot.sty}), welches Teil des +Pakets \texttt{pstricks} ist und mit der Anweisung +\texttt{\textbackslash{}usepackage\{pst-plot\}} einzubinden ist. Daher +braucht an dieser Stelle nicht weiter auf diese spezifischen Dinge +eingegangen zu werden. + +Das Paket \texttt{pst-plot} stellt die folgenden drei Plot-Funktionen +für die Darstellung externer Daten mit folgender Syntax zur Verfügung: + +\begin{verbatim} +\fileplot*[]{} +\dataplot*[]{} +\listplot*[]{} +\end{verbatim} + +Die Sternversionen stehen hierbei wie für alle Objekte von +\texttt{PSTricks} jeweils für die inverse Darstellung der Daten, +d.\,h. für eine standardmäßige Schwarz-Weiß-Grafik erhält man mit der +Sternversion das Negativ. Im Folgenden wird nur die normale +Darstellung berücksichtigt, da dies keine Einschränkung der +Allgemeinheit bedeutet. + +Im Zusammenhang mit den Plot-Funktionen sind noch folgende Befehle +interessant, die ebenfalls durch das Paket \texttt{pst-plot} definiert +sind: + +\begin{verbatim} +\readdata{}{} +\savedata{}{} +\end{verbatim} + +Weitere Informationen kann man der Dokumentation zu \texttt{pstricks} +entneh\-men\cite{pstricks} oder der umfangreichen Beschreibung in +\cite{companion,girou:01:,girou:02:}, die jedoch alle nicht die +wesentlichen Unterschiede zwischen den drei Plot-Funktionen +herausarbeiten. Für alle Beispiele wird jeweils die komplette +\texttt{pspicture}-Umgebung angegeben, so dass eine direkte Übernahme +der Beispiele möglich ist. Eine Dokumentation des +\texttt{multido}-Befehls findet man unter \url{CTAN: + /macros/latex209/contrib/multido/multido.doc}, alle anderen hier +nicht weiter erwähnten in der Dokumenation zu +\texttt{pstricks} \cite{pstricks}. + +\section{Plot-Stile} + +Insbesondere der Plot-Stil ist als Parameter von Bedeutung und kann +folgende Werte annehmen: + +\noindent\begin{tabularx}{1.0\linewidth}{rX}\toprule + \emph{Stilparameter} & \emph{Bedeutung}\\\midrule +% \hline + \texttt{plotstyle=dots} & Wertepaare als einzelne Punkte setzen\\ + \texttt{=line} & Wertepaare durch eine Gerade verbinden\\ + \texttt{=polygon} & Wie \texttt{line}, nur mit geschlossenem + Linienzug\\ + \texttt{=curve} & Interpolation zwischen den Wertepaaren, + wobei die Kurve über den Anfangs-/Endpunkt + hinausgehen kann\\ + \texttt{=ecurve} & Wie \texttt{curve}, nur beginnt/endet die + Kurve bei dem Anfangs-/Endwertepaar.\\ + \texttt{=ccurve} & Wie \texttt{curve}, nur mit geschlossenem + Kurvenzug\\\bottomrule +\end{tabularx} + +Bei einer fehlenden Angabe wird grundsätzlich die \texttt{line}-Option +gewählt. + + +\section{Beispiele für \texttt{\textbackslash{}fileplot}} + +\texttt{fileplot} ist immer dann angebracht, wenn in einer Datei +gespeicherte Zahlenpaare $(x|y)$ geplottet werden sollen. Diese sind +als reine Zahlenwerte paarweise in einer oder mehreren Zeilen +anzuordnen und dürfen nur auf vier verschiedene Arten getrennt sein +(Leerschritt, Komma oder runde bzw. geschweifte Klammern): + +\verb#x y x,y (x,y) {x,y}# + +Der als Trenner häufig benutzte Tabulator (\texttt{\textbackslash{}t} +bzw. \texttt{\textbackslash{}009}) ist demnach nicht zulässig, kann +aber leicht durch Texteditoren oder für Unix mit + +\texttt{tr '\textbackslash{}t' ' ' < inFile > outFile} + +ersetzt werden. Diese Datendateien dürfen bis auf das \TeX-übliche +Kommentarzeichen "`\%"' keine anderen Zeichen außer den +Zahlenwerten selbst enthalten. + +Das erste Beispiel zeigt ein UV/VIS-Absorptionsspektrum ($A=\lg +\frac{I_{0}}{I}$ als Funktion der Wellenlänge), während das zweite +eine Populationsentwicklung in Abhängigkeit des Brutfaktors darstellt +(Feigenbaum-Diagramm). Aus dem jeweils angegebenen Quellcode ergibt +sich die Art des Plot-Stils. + +\begin{minipage}[c]{0.45\linewidth}% + \centering\includegraphics{plot-pdf-fig1} +\end{minipage}% +\hfill\begin{minipage}[c]{0.52\linewidth}% + \scriptsize +\begin{verbatim} +\psset{xunit=0.003cm,yunit=1.5cm} +\begin{pspicture}(-0.25,-0.25)(1950,4) + \fileplot[plotstyle=line, linewidth=1.5pt]{% + fileplot.data} + \psaxes[dx=400,Dx=400]{->}(1900,4) + \multido{\n=200+200}{9}{% + \psline[linestyle=dotted](\n,0)(\n,4) + } + \multido{\n=+1}{5}{% + \psline[linestyle=dotted](0,\n)(1800,\n) + } +\end{pspicture} +\end{verbatim} +\end{minipage}% + +\begin{minipage}[c]{0.48\linewidth}% +\centering\includegraphics{plot-pdf-fig2} +\end{minipage}% +\hfill{}\begin{minipage}[c]{0.48\linewidth}% +\scriptsize\begin{center} +\begin{verbatim} +\psset{xunit=1.5cm,yunit=6cm} +\begin{pspicture}(-0.25,-.25)(4.25,1) + \fileplot[plotstyle=dots]{feigenbaum.data} + \psaxes{->}(0,0)(4.05,1) + \rput(4,-0.05){$x$} + \rput(0.2,1.05){$y$} + \rput[l](0.2,3.5){Feigenbaum-Diagramm} +\end{pspicture} +\end{verbatim} +\end{center} +\end{minipage}% + + +\texttt{fileplot} hat den Vorteil der einfachen Anwendung, aber den +wesentlichen Nachteil, extrem speicherintensiv zu sein, denn \TeX{} +muss erst alle Zahlenpaare vor einer weiteren Verarbeitung laden. Man +kann davon ausgehen, dass man bei mehr als 1000 Punkten +Schwierigkeiten mit der standardmäßig eingestellten +\TeX-Speicherkapazität bekommen kann. Weiterhin erhöht sich durch das +Laden der Zahlenpaare die Zeit eines Kompilationsvorgangs ganz +erheblich. + +Eine Möglichkeit, Speicherproblemen aus dem Weg zu gehen, ist die +Anwendung der \texttt{\textbackslash{}PSTtoEPS}-Funktion des Pakets +\texttt{pst-eps}, auf die hier jedoch nicht weiter eingegangen wird +(siehe dazu \cite{pstricks}). + + +\section{Beispiel für \texttt{\textbackslash{}dataplot}} + +Ebenso wie \texttt{\textbackslash{}fileplot} benötigt +\texttt{\textbackslash{}dataplot} einen externen Datensatz, der durch +eine andere Anwendung erstellt wurde. Im Gegensatz dazu kann dieser +externe Datensatz jedoch nicht mit \texttt{\textbackslash{}dataplot} +selbst geladen werden. Dies erfolgt mit dem oben angegebenen +Befehl \texttt{\textbackslash{}readdata}, beispielsweise + +\texttt{\textbackslash{}readdata\{\textbackslash{}feigenbaum\}\{feigenbaum.data\}} + +\texttt{\textbackslash{}feigenbaum} ist dann der Name des +Grafikobjekts. Die Zahl der eingelesenen Dateien ist nur durch den +Speicher bestimmt, d.\,h. dass mit \texttt{\textbackslash{}dataplot} +einfache Overlays möglich sind. Die Ausgabe dieser Daten erfolgt mit +\texttt{\textbackslash{}dataplot\{\}}, beispielsweise +\texttt{\textbackslash{}dataplot\{\textbackslash{}feigenbaum\}}. + +Das angegebene Beispiel zeigt zwei getrennte Datendateien, die in +einem Koordinatensystem dargestellt werden. Es handelt sich um die +Sortierzeiten der Verfahren "`Bubble-Sort"' und "`Select-Sort"' in +Abhängigkeit der Anzahl der zu sortierenden Elemente, wobei das +Verfahren der Parameter ist. Die Anordnung der Elemente war zu Beginn +jeweils zufällig verteilt. + +\begin{minipage}[c]{0.55\linewidth}% + \centering\includegraphics{plot-pdf-fig3} +\end{minipage}% +\hfill{}\begin{minipage}[c]{0.42\linewidth}% + \scriptsize\begin{center} +\begin{verbatim} +\psset{xunit=0.0005cm,yunit=0.005cm} +\begin{pspicture}(0,0)(10000,1000) + \readdata{\bubble}{bubble.data} + \readdata{\select}{select.data} + \dataplot[plotstyle=line]{\bubble} + \dataplot[plotstyle=line]{\select} + \psline{->}(0,0)(10000,0) + \psline{->}(0,0)(0,1000) + \rput[l](40,920){Zeit} + \rput[r](9990,-30){Elemente} + \rput[l](4500,800){Bubble-Sort} + \rput[l](7500,200){Select-Sort} +\end{pspicture} +\end{verbatim} +\end{center} +\end{minipage}% + + +Grundsätzlich bleibt festzustellen, dass für den reinen Anwender zwischen +\texttt{dataplot} und \texttt{fileplot} formal kein wesentlicher Unterschied +besteht. Bei größeren Datenmengen bringt \texttt{dataplot} den Vorteil +der schnelleren Verarbeitung und Darstellung, wobei es dafür aber +noch speicherplatzintensiver als \texttt{fileplot} ist. + +Weiterhin benutzt \texttt{\textbackslash{}dataplot} intern die im +nächsten Abschnitt beschriebene Funktion +\texttt{\textbackslash{}listplot}, wenn Parameter angegeben werden. +Daraus folgt, dass \texttt{\textbackslash{}dataplot} letztlich nur +Sinn macht, wenn Polygonzüge gezeichnet werden sollen. In diesem Fall +zeichnet sich diese Funktion durch eine größere Plot-Geschwindigkeit +aus, macht aber andererseits nichts anderes als die +\texttt{pspolygon}-Funktion. + + +\section{Beispiel für \texttt{\textbackslash{}listplot}} + +Im Gegensatz zu den vorhergehenden Plot-Funktionen wird das Argument +von \texttt{\textbackslash{}listplot} zuerst von \TeX{} expandiert, +wenn es sich um einen \TeX-Befehl handelt, andernfalls wird es +unverändert an \PS\ durchgereicht. Daraus folgt, dass man komplette +\PS-Programme im Argument von \texttt{\textbackslash{}listplot} +ablegen kann. Diese Möglichkeit der Kombination von \TeX{} und +\PS\ bleibt jedoch in der gesamten Literatur zu \texttt{PSTricks} +faktisch unberücksichtigt. Dies liegt wohl auch daran, dass +\texttt{PSTricks} sehr \PS-nah programmiert wurde, sodass sich +letztlich für jede Anwendung entsprechende \texttt{PSTricks}-Befehle +finden lassen. + +Das angegebene Beispiel zeigt in der Originaldarstellung die +Entwicklung eines Hènon-Attraktors. Die rechte Grafik enthält +zusätzlich zum normalen Datensatz einen durch erweiterten \PS-Code +erzwungenen "`Draft"'-Hinweis. Hierbei ist zum Verständnis allerdings +eine Kenntnis der \PS-Befehle unabdingbar, wenn dies fehlerfrei +erfolgen soll. Der angegebene Source\-code enthält aus Platzgründen +nicht die eigentlichen Daten, die lediglich aus einer Folge von +Zahlenpaaren bestehen, die durch "`space"' voneinander zu trennen +sind. + +\begin{minipage}[c]{0.48\linewidth}% +\centering\includegraphics{plot-pdf-fig4} +\end{minipage}% +\hfill{}\begin{minipage}[c]{0.48\linewidth}% +\centering\includegraphics{plot-pdf-fig5} +\end{minipage} + +\begin{minipage}[t]{0.48\linewidth}% +\scriptsize\begin{verbatim} +\readdata{\henon}{henon.dat} +\psset{xunit=1.5cm, yunit=3cm} +\begin{pspicture}(-2,-0.75)(2.25,1.5) + \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25) + \listplot[% + showpoints=true,% + plotstyle=curve]{\henon} +\end{pspicture} +\end{verbatim} +\end{minipage}% +\hfill{}\begin{minipage}[t]{0.48\linewidth}% +\scriptsize\begin{center}\begin{verbatim} +\newcommand{\DataB}{% + [ ... Daten ... ] + gsave % speichere Grafikstatus + /Helvetica findfont 40 scalefont setfont + 45 rotate % Rotiere um 45 Grad + 0.9 setgray % 1 entspricht Weiß + -60 10 moveto (DRAFT) show + grestore +} +\psset{xunit=1.5cm, yunit=3cm} +\begin{pspicture}(-3,-0.75)(2.25,1.5) + \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25) + \listplot[% + showpoints=true,% + plotstyle=curve]{\dataB} +\end{pspicture} +\end{verbatim} +\end{center} +\end{minipage}% + + +Zum Manipulieren des Datensatzes von \texttt{\textbackslash{}listplot} +kann alternativ auch die entsprechende Funktion aus \texttt{pst-plot} +verändert werden. Möchte man beispielsweise, aus welchen Gründen auch +immer, die $x|y$-Werte vertauschen und den Graphen um 45° rotieren +lassen (was einer Rotation um die x-Achse mit anschließender Drehung +entspricht), so kann dies einfach durch Neudefinition von +\texttt{\textbackslash{}pst@def} erfolgen, was dann zur folgenden +Abbildung führt: + +\begin{minipage}{0.48\linewidth} +\scriptsize\begin{center}\begin{verbatim} +\makeatletter +\pst@def{ScalePoints}<% +%---------------------------------------- + 45 rotate % rotiere alle Objekte +%---------------------------------------- + /y ED /x ED + counttomark dup dup cvi eq + not { exch pop } if + /m exch def /n m 2 div cvi def + n { +%---------------------------------------- + exch % tausche oberste Stackelemente +%---------------------------------------- + y mul m 1 roll + x mul m 1 roll + /m m 2 sub + def } repeat> +\makeatother +\end{verbatim} +\end{center}\end{minipage}% +\hfill +\begin{minipage}{0.48\linewidth} + \centering\includegraphics{plot-pdf-fig6} +\end{minipage} + + +\bibliography{plot} + +\address{Herbert}{Voß}{Wasgenstr. 21\\14129 Berlin\\voss@perce.de} +\address{Laura Elizabeth}{Jackson}{Raleigh, North Carolina (USA)\\ + lejacks2@unity.ncsu.edu } +\end{document} diff --git a/Master/texmf-dist/doc/generic/pst-plot/doc/pst-plot-doc.pdf b/Master/texmf-dist/doc/generic/pst-plot/doc/pst-plot-doc.pdf index fbcac7deaec..036f4c9f0dc 100644 Binary files a/Master/texmf-dist/doc/generic/pst-plot/doc/pst-plot-doc.pdf and b/Master/texmf-dist/doc/generic/pst-plot/doc/pst-plot-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.bib b/Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.bib new file mode 100644 index 00000000000..817ec870cce --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.bib @@ -0,0 +1,120 @@ +%% -*-bibtex-*- +@STRING{tugboat = {TUGboat} } +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Article{ dtk02.1:voss:mathematischen, + author = {Herbert Vo{\ss}}, + title = {Die mathematischen Funktionen von Postscript}, + journal = dtk, + year = 2002, + volume = {1/02}, + altvolume = 1, + altnumber = 14, + month = mar, + pages = {}, + annote = bretter, + keywords = {}, + abstract = { \PS, faktisch genauso alt wie {\TeX}, ist im + Verh{\"a}ltnis dazu allgemein noch weniger bekannt, wenn es + darum geht zu beurteilen, was es denn nun im eigentlichen + Sinne ist. Au{\ss}erdem wird h{\"a}ufig vergessen, dass + sich mit den \PS-Funktionen viele Dinge erledigen lassen, + bei denen sonst auf externe Programme zur{\"u}ckgegriffen + wird. Dies wird im Folgenden f{\"u}r die mathematischen + Funktionen im Zusammenhang mit dem Paket \texttt{pst-plot} + gezeigt. } +} + +@Book{companion, + author = {Michel Goosens and Frank Mittelbach and Alexander + Samarin}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + year = {1997}, + address = {Reading, Mass.} +} + +@Book{voss:chaos, + author = {Herbert Vo{\ss}}, + title = {Chaos und {F}raktale selbst programmieren: von {M}andelbrotmengen {\"u}ber {F}arbmanipulationen zur perfekten Darstellung}, + publisher = {{Franzis Verlag}}, + year = {1994}, + address = {Poing} +} + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{girou:02:, + author = {{Timothy van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {PostScript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Book{ThinkPostScript, + Author = {Reid, Glenn C.}, + Title = {Thinking in {P}ost{S}cript}, + Publisher = {Addison-Wesley}, + Address = {Boston}, + year = 1990, +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for generic {\TeX}}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{http://www.tug.org/application/PSTricks}}, + Note = {}, + year = 1993 +} + +@Manual{pst-plot, + Title = {\texttt{pst-plot}: Plotting two dimensional functions and data}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{CTAN:graphics/pstricks/generic/pst-plot.tex}}, + Note = {}, + year = 1999 +} + +@Manual{multido, + Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{CTAN:/graphics/pstricks/generic/multido.tex}}, + Note = {}, + year = 1997 +} + diff --git a/Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.tex b/Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.tex new file mode 100644 index 00000000000..bc6a4f7a9c4 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-plot/doc/tugboat01-4.tex @@ -0,0 +1,705 @@ +%\documentclass[final,harvardcite]{ltugboat} +\documentclass[final]{ltugboat} +\PrelimDraftfalse +\InputIfFileExists{tugboat.dates}% + {}{} +\InputIfFileExists{tb72pages.tex}% + {}{\def\TBpstplot{1001}} +\setcounter{page}{\TBpstplot} + +\overfullrule=6pt + +\usepackage[T1]{fontenc} +\usepackage[latin1]{inputenc} +\usepackage[scaled=0.96]{helvet} +\usepackage{mathptmx} +\usepackage{courier} +\usepackage{comment} +\usepackage{tabularx} + +\usepackage{graphicx} +%\usepackage{pstcol} +%\usepackage{pst-plot}% +% +\newcommand\verbI[1]{{\small\texttt{#1}}} +\newcommand\CMD[1]{{\small\textbackslash\texttt{#1}}} +\setlength{\belowcaptionskip}{\abovecaptionskip} +% +\usepackage{listings} +\lstset{language=[LaTeX]TEX,basicstyle=\ttfamily\footnotesize,% + extendedchars=true,numbers=left,numberstyle=\tiny,% + xleftmargin=2em,breaklines=true} +% +\usepackage{ifpdf} +\ifpdf% + \usepackage[% + pdftex,% + pdfauthor={Jana and Herbert Voss},% + pdftitle={2D Plots},% + linktocpage,% + colorlinks]{hyperref} +\hypersetup{% +colorlinks,linkcolor={black}, citecolor={black}, pagecolor={black}, +urlcolor={black} +} + +\else + \usepackage[% + ps2pdf,% + pdfauthor={Jana and Herbert Voss},% + pdftitle={2D Plots},% + linktocpage,% + colorlinks]{hyperref} +\fi +\makeatletter +\usepackage{url} + +\begin{document} + +\sectitle{Graphics} + + +\title{The plot functions of \texttt{pst-plot}\thanks{Translated from +``Die Plot-Funktionen von pst-plot,'' +\textsl{Die TeXnische Kom\"odie} \textbf{2/02}, June 2002, pages 27-34, +with permission.}} + +\author{Jana Voß} +\address{Wasgenstr. 21\\14129 Berlin \textsc{GERMANY}} +\netaddress{Jana@perce.de} +% +\author{Herbert Voß} +\address{Wasgenstr. 21\\14129 Berlin \textsc{GERMANY}} +\personalURL{http://www.perce.de} +\netaddress{voss@perce.de} + +\maketitle + +\begin{abstract} + Plotting of external data records is one of the standard problems of + technical and industrial publications. One common approach is + importing the data files into an external program, such as + \verbI{gnuplot}, provided with axes of coordinates and further + references, and finally exported to \LaTeX. By contrast, in this + article we explain ways to get proper data plotting without using + external applications. +\end{abstract} + +\section{Introduction} + +The history and the meaning of \PS{} have been covered sufficiently in +many articles. For the programming language \PS{} have a look at +\cite{PostScript,ThinkPostScript}. The package \verbI{pst-plot} +\cite{pst-plot} under consideration here is part of the \verbI{pstricks} +project. It must be loaded into a \LaTeX{} document as usual with +\CMD{usepackage\{pst-plot\}} or alternatively, for documents written in Plain\TeX, +with \CMD{input pst-plot.tex}. + +\verbI{pst-plot} provides three plot macros for the representation of +external data, with the following syntax: + +{\small\begin{verbatim} +\listplot*[]{} +\dataplot*[]{} +\fileplot*[]{} +\end{verbatim}} + + The starred forms have the same meaning as with all macros of + \verbI{pstricks}: to plot the data in a reversed mode. Thus, for a + default black-on-white diagram one produces the negative with the + starred command form, namely white-on-black. Additionally, a negative plot + implies that \PS{} closes the path of the points from the last to + the first one and fills all points inside this closed path with the + actual fillcolor. For our purposes in this article there will be no + real sense in this negative view; therefore, all of the following + examples are plotted with the normal (unstarred) form only. + +For further information about the package \verbI{pstricks} have a look at the (more +or less) official documentation \cite{pstricks}, or the extensive +description in the ``standard \LaTeX'' book \cite{companion} or in +\cite{girou:01:,girou:02:}. Altogether, however, these do not fully +describe the substantial differences between these three plot macros. + +For all of the examples in this article, the complete \verbI{pspicture} +environment is indicated, so that the examples may be directly copied. +The Documentation of the \verbI{multido} macro used here can be found in the +package itself \cite{multido}; macros not otherwise mentioned are +described in the \verbI{pstricks} documentation \cite{pstricks}. + +The general \verbI{plotstyle} parameter is particularly important, and +can take the values shown in table \ref{tab:options}. + +\begin{table} +\caption{Possible options}\label{tab:options} +\begin{tabularx}{1.0\linewidth}{r|X} +style option& meaning\\ +\hline +\verbI{plotstyle=dots} & plot $(x,y)$ as a dot\\ +\verbI{=line} & draw a line from a dot to the following one\\ +\verbI{=polygon} & nearly the same as \verbI{line}, but with a line from the last to the first dot\\ +\verbI{=curve} & interpolation between three dots, whereby the curve can go beyond the point of origin and/or termination point\\ +\verbI{=ecurve} & like \verbI{curve}, but ends at the first/last dot\\ +\verbI{=ccurve} & like \verbI{curve}, but closed\\ +\end{tabularx} +\end{table} + +By default, the \verbI{line} option is selected. + +The following general commands are also useful in conjunction with the +plot commands. They are also defined by the \verbI{pst-plot} package: + +{\small\begin{verbatim} +\readdata{}{} +\savedata{}{} +\end{verbatim}} + + In the following examples only the \CMD{readdata} macro is used, + but it would be straightforward to create examples with + \CMD{savedata}. + +\section{Examples for \CMD{listplot}} + +The syntax of \CMD{listplot} is : + +{\small\begin{verbatim} +\listplot{} +\end{verbatim}} + + The data macro may contain any additional \AllTeX- or + \PS-commands. The \AllTeX{} macros are expanded first before they + are passed as a \textbf{list} of $x|y$ values to \PS. The data + records can be defined inside the document like + +{\small\begin{verbatim} +\newcommand{\dataA}{ + 1.00000000 1.00000000 + 0.56000000 0.31000000 + 0.85841600 0.17360000 + ... +\end{verbatim}} + +\noindent or can be read from an external data file with the \CMD{readdata} macro: + +{\small\begin{verbatim} \readdata{\dataA}{/anyPath/data.dat} +\end{verbatim}} + + The example in figure \ref{fig:listplot1} shows the Henon + attractor, a typical graphic of a system with chaotic + behavior\cite{voss:chaos}. + + Figure \ref{fig:listplot2} is nearly the same as + figure~\ref{fig:listplot1}, with the addition of \PS{} code to + get + the "Draft" watermark. (Some familiarity with \PS{} is needed to + fully understand its operation.) To save space, listing + \ref{lst:listplot2} does not contain the data, which is nothing + more than a sequence of pairs of floats, each value separated by a + space, as shown above. + +\begin{figure}[htb] +\centering +\begin{comment} +\PSforPDF{% +\readdata{\henon}{henon.dat} +\psset{xunit=1.5cm, yunit=3cm} +\begin{pspicture}(-2,-0.5)(2.25,1.25) + \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25) + \listplot[% + showpoints=true,% + plotstyle=curve]{\henon} +\end{pspicture}% +} +\end{comment} +\includegraphics{fig4} +\caption{Example for \CMD{listplot}}\label{fig:listplot1} +\end{figure} + +\begin{figure}[htb] +\centering +\begin{comment} +\newcommand{\dataA}{ + 1.00000000 1.00000000 + 0.56000000 0.31000000 + 0.85841600 0.17360000 + 0.11249564 0.26610896 + 1.24788537 0.03487365 +-1.20752013 0.38684447 +-0.71282656 -0.37433124 +-0.10602649 -0.22097623 + 0.76283584 -0.03286821 + 0.12916912 0.23647911 + 1.21245320 0.04004243 +-1.07681914 0.37586049 +-0.29387634 -0.33381393 + 0.54182291 -0.09110166 + 0.48615456 0.16796510 + 0.82762650 0.15070791 + 0.16435741 0.25656422 + 1.21766498 0.05095080 +-1.08414872 0.37747614 +-0.31506881 -0.33608610 + 0.52096746 -0.09767133 + 0.51150245 0.16149991 + 0.78474587 0.15856576 + 0.27177620 0.24327122 + 1.13690951 0.08425062 +-0.77704042 0.35244195 + 0.48298173 -0.24088253 + 0.42320673 0.14972434 + 0.89181467 0.13119409 +-0.01408602 0.27646255 + 1.27617683 -0.00436667 +-1.34958997 0.39561482 +-1.22719125 -0.41837289 +-1.58701052 -0.38042929 + gsave + /Helvetica findfont 40 scalefont setfont + 45 rotate + 0.9 setgray + -60 10 moveto (DRAFT) show + grestore +} +\psset{xunit=1.5cm, yunit=3cm} +\begin{pspicture}(-2,-0.5)(2.25,1.25) + \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25) + \listplot[% + showpoints=true,% + linecolor=red,% + plotstyle=curve]{\dataA} +\end{pspicture}% +\end{comment} +\includegraphics{fig5} +\caption{Example for modified \CMD{listplot}}\label{fig:listplot2} +\end{figure} + + +\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:listplot1}},% + label={lst:listplot1}] +\readdata{\henon}{henon.dat} +\psset{xunit=1.5cm, yunit=3cm} +\begin{pspicture}(-3,-0.5)(2.25,1.25) + \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25) + \listplot[% + showpoints=true,% + linecolor=red,% + plotstyle=curve]{\dataA} +\end{pspicture} +\end{lstlisting} + + +\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:listplot2}},% + label={lst:listplot2}] +\newcommand{\DataA}{% + [ ... data ... ] + gsave % save graphic status + /Helvetica findfont 40 scalefont setfont + 45 rotate % rotate by 45 degrees + 0.9 setgray % 1 is color white + -60 10 moveto (DRAFT) show + grestore +} +\psset{xunit=1.5cm, yunit=3cm} +\begin{pspicture}(-3,-0.5)(2.25,1.25) + \psaxes{->}(0,0)(-2,-0.5)(1.5,1.25) + \listplot[% + showpoints=true,% + plotstyle=curve]{\dataA} +\end{pspicture} +\end{lstlisting} + + +Naturally, \verbI{[... data ...]} is replaced by all +the $x|y$-values; they're omitted here only to save space. + +As an alternative to direct modification of the data set passed to +\CMD{listplot}, one can redefine the macro \verbI{defScalePoints} from +\verbI{pst-plot}. For example, to change the $x|y$ values and then +rotate the whole plotted graphic (don't ask why!), the redefinition is +as shown in listing \ref{lst:listplot3}. + +\begin{lstlisting}[% + caption={\LaTeX\ source for figure \ref{fig:listplot3}},% + label={lst:listplot3}] +\makeatletter +\pst@def{ScalePoints}<% +%------------------------------------- + 45 rotate % rotate the whole object +%------------------------------------- + /y ED /x ED + counttomark dup dup cvi eq not { exch pop } if + /m exch def /n m 2 div cvi def + n { +%------------------------------------- + exch % exchange the last two elements +%------------------------------------- + y mul m 1 roll + x mul m 1 roll + /m m 2 sub + def } repeat> +\makeatother +\end{lstlisting} + +\noindent This gives figure \ref{fig:listplot3}. + + + +\begin{figure}[htb] +\centering +\begin{comment} +\makeatletter +\pst@def{ScalePoints}<% +%----------------------------------------------- + 45 rotate % rotate the whole object +%----------------------------------------------- + /y ED /x ED + counttomark dup dup cvi eq not { exch pop } if + /m exch def /n m 2 div cvi def + n { +%----------------------------------------------- + exch % exchange the last two elements +%----------------------------------------------- + y mul m 1 roll + x mul m 1 roll + /m m 2 sub + def } repeat> +\makeatother +\readdata{\henon}{henon.dat} +\begin{pspicture}(-0.5,-2.75)(3,3) +\psset{xunit=3cm, yunit=1.5cm} + \psaxes{->}(0,0)(-0.5,-2)(1.25,2) + \listplot[% + showpoints=true,% + plotstyle=curve]{\henon} +\end{pspicture}% +\end{comment} +\includegraphics{fig6} +\caption{Example for \CMD{listplot} with a redefined \verbI{ScalePoints}}\label{fig:listplot3} +\end{figure} + +Thus, the advantage of \CMD{listplot} is that one can easily modify the +data values without any external program. Here is one more example---suppose +you have the following data records: + +{\small\begin{verbatim} +1050, 0.368 +1100, 0.371 +1200, 0.471 +1250, 0.428 +1300, 0.391 +1350, 0.456 +1400, 0.499 +1500, 1.712 +1550, 0.475 +1600, 0.497 +\end{verbatim}} + +\noindent which perhaps came automatically from a technical device. The +unit of the x-values is micrometer but it makes more sense to use +millimeter for the plot. A redefinition of \verbI{ScalePoints} makes it +very easy to plot the data with this change of scale: + +\begin{lstlisting}[caption={Rescale all x values},label={lst:lstplot}] + \makeatletter +\pst@def{ScalePoints}<% + /y ED /x ED + counttomark dup dup cvi eq not { exch pop } if + /m exch def /n m 2 div cvi def + n { + y mul m 1 roll + x mul 1000 div m 1 roll% <-- divide by 1000 + /m m 2 sub + def } repeat> +\makeatother +\end{lstlisting} + +\begin{figure}[htb] +\centering +\begin{comment} +\makeatletter +\begin{pdfpic} +\pst@def{ScalePoints}<% + /y ED /x ED + counttomark dup dup cvi eq not { exch pop } if + /m exch def /n m 2 div cvi def + n { + y mul m 1 roll + x mul 1000 div m 1 roll% <-- divide by 1000 + /m m 2 sub + def } repeat> +\makeatother +\def\dataA{% +1050 0.368 +1100 0.371 +1200 0.471 +1250 0.428 +1300 0.391 +1350 0.456 +1400 0.499 +1500 1.712 +1550 0.475 +1600 0.497 }% +\psset{xunit=5} +\begin{pspicture}(1,-0.25)(2,2.25) + \psaxes[Dx=0.25,Ox=1]{->}(1,0)(2,2) + \psaxes[Dx=0.05,Ox=1,labels=none,ticksize=0.05](1,0)(2,0) + \listplot[plotstyle=dots,linecolor=red]{\dataA} +\end{pspicture}% +\end{pdfpic} +\end{comment} +\includegraphics{fig7} +\caption{Example for modified data values with a redefined \verbI{ScalePoints}} \label{fig:lstplot4} +\end{figure} + + + +\section{Examples for \CMD{dataplot}} + +\CMD{dataplot} has the same syntax as \CMD{listplot}, so the first +question is, what is the difference between the two? \CMD{listplot} +builds a list of all the data and then multiplies all values with the +length unit. This takes some time, so you may prefer a so-called +``quick plot'', where the data can be passed more quickly to \PS, +depending on the plotstyle and especially the option \verbI{showpoints}. +Table \ref{tab:quickplot} shows whether this is possible. A quick plot +is not possible with \CMD{listplot}, whereas \CMD{dataplot} uses it +whenever possible. When it is not possible, \CMD{dataplot} simply calls +\CMD{listplot}. + + +\def\hI{\hangindent=3em} +\begin{table}[htb] +\caption{Possible options for a ''quick plot``}\label{tab:quickplot} +\begin{tabularx}{\columnwidth}{lX|l} +plotstyle & options & macro\\\hline +\verbI{line} & all, except & quick plot\\ + & \verbI{linearc}, \verbI{showpoints}, \verbI{arrows}, & \CMD{listplot}\\ +\verbI{polygon} & all, except & quick plot\\ + & \verbI{linearc}, \verbI{showpoints} & \CMD{listplot}\\ +\verbI{dots} & all & quick plot\\ +\verbI{bezier} & all, except & quick plot\\ + &\verbI{arrows}, \verbI{showpoints} & \CMD{listplot}\\ +\hI\verbI{cbezier} & all, except& \CMD{listplot}\\ + &\verbI{showpoints} & quick plot\\ +\verbI{curve} & all & \CMD{listplot}\\ +\verbI{ecurve} & all & \CMD{listplot}\\ +\verbI{ccurve} & all & \CMD{listplot} +\end{tabularx} +\end{table} + + +\CMD{dataplot} needs to be passed a macro holding the data. The data is +typically saved in an external file, which can be read by (for instance) +the \CMD{readdata} macro, as follows: + +{\small\begin{verbatim} +\readdata{}{} +\end{verbatim}} + +\noindent For example: + +{\small\begin{verbatim} +\readdata{\feigenbaum}{feigenbaum.data} +\end{verbatim}} + +The amount of data is limited only by \TeX's memory. The above example +can be plotted with: + +{\small\begin{verbatim} +\dataplot{\feigenbaum} +\end{verbatim}} + + Overlays with different data files are also possible. For example, + figure~\ref{fig:dataplot} shows the use of two different data files + which are plotted using one coordinate system. It shows the sorting + time for ``Bubble-Sort'' and ``Select-Sort{}'' as a function of the + number of the elements. + +\begin{figure} +\centering +\begin{comment}% +\psset{xunit=0.0005cm,yunit=0.005cm} +\begin{pspicture}(0,-50)(10000,1100) + \readdata{\bubble}{bubble.data} + \readdata{\select}{select.data} + \dataplot[% + plotstyle=line,% + linecolor=blue]{\bubble} + \dataplot[% + plotstyle=line,% + linecolor=red,% + linewidth=2pt]{\select} + \psline{->}(0,0)(10000,0) + \psline{->}(0,0)(0,1000) + \rput[l](40,920){time} + \rput[r](9990,-30){elements} + \rput[l](4500,800){Bubble-Sort} + \rput[l](7500,200){Select-Sort} +\end{pspicture}% +\end{comment} +\includegraphics{fig0} +\caption{Example for \CMD{dataplot}}\label{fig:dataplot} +\end{figure} + +\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:dataplot}}] +\psset{xunit=0.0005cm,yunit=0.005cm} +\begin{pspicture}(0,-50)(10000,1100) + \readdata{\bubble}{bubble.data} + \readdata{\select}{select.data} + \dataplot[% + plotstyle=line,% + linecolor=blue]{\bubble} + \dataplot[% + plotstyle=line,% + linecolor=red,% + linewidth=2pt]{\select} + \psline{->}(0,0)(10000,0) + \psline{->}(0,0)(0,1000) + \rput[l](20,995){time} + \rput[r](9990,-20){elements} + \rput[l](4500,800){Bubble-Sort} + \rput[l](7500,200){Select-Sort} +\end{pspicture} +\end{lstlisting} + +In summary, the advantage of \CMD{dataplot} is the possibility of a +''quick plot``, and the advantage of \CMD{listplot} is that it is easy +to manipulate the data values before they are plotted. + + +\section{Examples for \CMD{fileplot}} + +\CMD{fileplot} can be used whenever $(x|y)$ data that is saved in a file +is to be plotted. The values must be given as pure numerical values in +pairs, one pair on each line, and may have spaces, commas, parentheses, +and braces as punctuation, as follows: + +\begin{verbatim} +x y +x,y +(x,y) +{x,y} +\end{verbatim} + +The tab character (\CMD{t} or \acro{ASCII} \CMD{009}) is often used as a +separator, but tab is \emph{not} valid here. Tabs may be converted to +spaces in many ways, for example with the standard Unix utility +\texttt{tr}: + +{\small\begin{verbatim} +tr '\t' ' ' outFile +\end{verbatim}} + +The data files may also contain \% characters, but no other characters +are allowed. + +Our first example for \CMD{fileplot} is shown in +figure~\ref{fig:fileplot1}, which is an \acro{UV/VIS} absorber spectrum +$A=\lg \frac{I_{0}}{I}$ as a function of the wavelength. The second +example (figure~\ref{fig:fileplot2}) shows the evolution of a population +as a function of the spawn factor (Feigenbaum diagram +\cite{voss:chaos}). The source code for these images is shown in +listings~\ref{lst:fileplot1} and~\ref{lst:fileplot2}. + +\begin{figure}[htb] +\centering +\begin{comment}% +\psset{xunit=0.0025cm,yunit=1.1cm} +\begin{pspicture}(-25,-.25)(1950,4) + \fileplot[plotstyle=line, linewidth=1.5pt]{fileplot.data} + \psaxes[dx=400,Dx=400]{->}(1900,4) + \multido{\n=200+200}{9}{% + \psline[linestyle=dotted](\n,0)(\n,4) + } + \multido{\n=+1}{5}{% + \psline[linestyle=dotted](0,\n)(1800,\n)% + } +\end{pspicture}% +\end{comment} +\includegraphics{fig1} +\caption{Example for \CMD{fileplot}}\label{fig:fileplot1} +\end{figure} + +\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:fileplot1}},label={lst:fileplot1}] +\psset{xunit=0.0025cm,yunit=1.1cm} +\begin{pspicture}(-25,-.25)(1950,4) + \fileplot[plotstyle=line]{fileplot.data} + \psaxes[dx=400,Dx=400]{->}(1900,4) + \multido{\n=200+200}{9}{% + \psline[linestyle=dotted](\n,0)(\n,4)% + } + \multido{\n=+1}{5}{% + \psline[linestyle=dotted]% + (0,\n)(1800,\n)% + } +\end{pspicture} +\end{lstlisting} + + +\begin{figure}[htb] +\centering +\begin{comment}% +\psset{xunit=1.25cm,yunit=5cm} +\begin{pspicture}(-0.25,-0.05)(4.25,1.2) + \fileplot[plotstyle=dots]{feigenbaum.data} + \psaxes{->}(0,0)(4.05,1) + \rput(4,-0.05){$x$} + \rput(0.2,1.05){$y$} + \rput[l](0.2,3.75){Feigenbaum-Diagram} +\end{pspicture}% +\end{comment} +\includegraphics{fig2} +\caption{Another example for \CMD{fileplot}}\label{fig:fileplot2} +\end{figure} + + +\begin{lstlisting}[caption={\LaTeX\ source for figure \ref{fig:fileplot2}},label={lst:fileplot2}] +\psset{xunit=1.5cm,yunit=6cm} +\begin{pspicture}(-0.25,-0.05)(4.25,1) + \fileplot[plotstyle=dots]{% + feigenbaum.data} + \psaxes{->}(0,0)(4.05,1) +\end{pspicture} +\end{lstlisting} + +As you may see in listing \ref{lst:fileplot}, \CMD{fileplot} does little +of its own. It first calls \CMD{readdata} to read the data, and then, +depending on the kind of data and specified options, \CMD{fileplot} uses +\CMD{dataplot} for a quick plot if possible. Otherwise, it falls back +to \CMD{listplot}. + +\begin{lstlisting}[caption={The source of the \CMD{fileplot} macro},label={lst:fileplot}] +\def\fileplot{\def\pst@par{}\pst@object{fileplot}} +\def\fileplot@i#1{% + \pst@killglue + \begingroup + \use@par + \@pstfalse + \@nameuse{testqp@\psplotstyle}% + \if@pst + \dataplot@ii{\pst@readfile{#1}}% + \else + \listplot@ii{\pst@altreadfile{#1}}% + \fi + \endgroup + \ignorespaces% +} +\end{lstlisting} + +\CMD{fileplot} has the advantage of being easy to use, but the +disadvantage of needing a lot of memory: \TeX{} has to read the all the +data values before it can process anything. As a rule of thumb, when +there are more than 1000 data entries \TeX{}'s main menory must be +increased. Furthermore, the running time may be enormous, especially on +slow machines. + +To prevent such problems, one can use the \CMD{PSTtoEPS} macro to create +an \texttt{eps} file. For more information, see the documentation of +\verbI{pstricks} \cite{pstricks}. + +\bibliographystyle{plain} +\bibliography{\jobname} +%\bibliographystyle{ltugbib} + +\makesignature + +\end{document} -- cgit v1.2.3