[pstricks] \listplot, single point and regression
Herbert Voss
Herbert.Voss at alumni.TU-Berlin.DE
Fri Feb 18 20:41:11 CET 2005
Poul Riis wrote:
> 1) Is it possible to read the coordinates of point no. n when using
> \listplot?
The nodes are named as N1 N2 N3 ...
This version needs the number of lines in the data file.
If your data is not comma separated then change the line
\pnode(\Data){\NodeName}
to
\pnode(! \Data ){\NodeName}
if space separated.
% the contents of the external data file "node.data"
\iffalse
142.264, 0.0
134.555, 46.193
112.266, 87.3802
77.8109, 119.098
34.9237, 137.91
-11.7481, 141.778
-57.1467, 130.281
-96.3526, 104.667
-125.117, 67.71
-140.323, 23.4158
-140.323, -23.4159
-125.117, -67.7101
-96.3525, -104.667
-57.1466, -130.281
-11.748, -141.778
34.9237, -137.91
77.8109, -119.098
112.266, -87.3802
134.555, -46.193
142.264, 0.0
\fi
\documentclass[a4paper]{article}
\usepackage{pstricks,pst-plot,pst-node,multido}
\SpecialCoor
\psset{unit=1pt}
\def\FileName{node.data}% the data file
\makeatletter
\def\saveDataAsNodes{%
\typeout{Open file \FileName}%
\openin7=\FileName%
\newcount\nMax\nMax=21\relax% datarecords+1
\newcount\nrepeat\nrepeat=1\relax%
\loop%
\def\NodeName{N\the\nrepeat}%
\ifnum\nrepeat<\nMax
\read7 to \Data
\pnode(\Data){\NodeName}
\typeout{\NodeName -> \Data}
\advance\nrepeat by 1
\repeat%
\closein7%
}
%
\makeatother
\begin{document}
\begin{center}
\begin{pspicture}(-150,-150)(150,150)
\saveDataAsNodes% must be inside the pspicture environment
% \fileplot[linecolor=red,linewidth=1pt,linestyle=dashed]{\FileName}%
\multido{\iA=1+1}{20}{
\pscircle*[linecolor=blue](N\iA){10pt}}% Node: N#
\end{pspicture}
\end{center}
\end{document}
> 2) Is it possible to do linear (and other types of) regression with
> pstricks?
sure, but we need someone who implements it ... ;-)
Herbert
--
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