[pstricks] \listplot, single point and regression

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Sat Feb 19 12:14:09 CET 2005


Poul Riis wrote:

> I can't make this example work on my computer, even if it says 'no errors
> found'.  The strange thing is that apparently no log-file is produced!?!?!?
> Moreover, I find it rather inconvenient that one has to tell the computer
> the number of data in the data file. Rather, the computer should tell me!

that's true, indeed ... :-)

Herbert



% the contents of the external data file
\begin{filecontents}{node.data}
   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
\end{filecontents}

\documentclass[a4paper]{article}

\usepackage{pstricks,pst-plot,pst-node,multido}
\SpecialCoor
\psset{unit=1pt}

\def\FileName{node.data}% the data file

\makeatletter
\newcount\nrepeat\nrepeat=1\relax%
\def\saveDataAsNodes{%
   \typeout{Open file \FileName}%
   \openin7=\FileName%
   \loop%
     \def\NodeName{N\the\nrepeat}%
     \read7 to \Data
     \ifeof7\else
       \ifx\Data\@empty\else\pnode(\Data){\NodeName}
         \typeout{\NodeName -> \Data}
         \advance\nrepeat by 1
       \fi
   \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}



-- 
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