# How to draw a curve from a previously calculated list of points

If I understand what is required, then (somewhat surprisingly) \draw plot [...] (P-\x); works, provided you set the domain and samples key correctly. Then options like smooth can be used.

\documentclass[tikz,borde=5]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.2]
\def\R{5}
\foreach \i [evaluate={\a=18*\i; \r=\R+\i;}] in {0, 1,...,20}
\fill (\a:\r) coordinate (P-\i) circle [radius=0.2]
node [anchor=\a+180, font=\tiny] {$P_{\i}$};
\draw[blue] plot [domain=0:20, samples=21,smooth] (P-\x);
\end{tikzpicture}
\end{document}


Alternatively, the coordinates can be stored in a macro (this has the advantage any coordinate format could then be used):

\documentclass[tikz,borde=5]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.2]
\def\R{5}
\foreach \i [evaluate={\a=18*\i; \r=\R+\i;}] in {0, 1,...,20}
\fill (\a:\r) coordinate (P-\i) circle [radius=0.2]
node [anchor=\a+180, font=\tiny] {$P_{\i}$};
\def\coords{}
\foreach \i in {0,...,20}{\xdef\coords{\coords(P-\i)}}
\draw[blue] plot [smooth] coordinates \coords;
\end{tikzpicture}
\end{document}


Both methods produce the same result:

You could define your list as expanded macro, for example by using:

\def\LL{}
\foreach \ii in {1,2,3,...,20}{
\xdef\LL{\LL (P-\ii)}
}


and then it works

\documentclass[tikz,border=7pt]{standalone}

\begin{document}
\begin{tikzpicture}[scale=0.2]
\def\RR{5}
%calcul des coordonnées des points
%calculation of the coordinates of the points
\foreach \ii in {0, 1,2,3,...,20}{
\pgfmathsetmacro{\aa}{360 * \ii/20}
\pgfmathsetmacro{\rr}{\RR + \ii}
\coordinate(P-\ii) at (\aa:\rr);
}
%dessin des points de la spirale/drawing spiral points
\foreach \ii in {1,2,3,...,20}{
\node[fill=black,inner sep=0,minimum size=0.2cm,circle]at (P-\ii){};
}
%Création de la liste point/ Creating the point list
\def\LL{}
\foreach \ii in {1,2,3,...,20}{
\xdef\LL{\LL (P-\ii)}
}
%affichage de la liste / list view
\node{\LL};
% La commande ci-dessous fonctionne.
% The command below works.
\draw[blue] plot coordinates { \LL};
\end{tikzpicture}
\end{document}


You can use another \foreach loop to draw the curve.

\documentclass[11pt]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=0.2]
\def\RR{5}
%calcul des coordonnées des points
%calculation of the coordinates of the points
\foreach \ii in {0, 1,2,3,...,20}{
\pgfmathsetmacro{\aa}{360 * \ii/20}
\pgfmathsetmacro{\rr}{\RR + \ii}
\coordinate(P-\ii) at (\aa:\rr);
}

%dessin de la spirale/drawing of the spiral
\foreach \ii in {1,2,3,...,20}{
\node[fill=black,inner sep=0,minimum size=0.2cm,circle]at (P-\ii){};
}

%par contre, en recopiant les données affichées on peut tracer la spirale
% on the other hand, by copying the displayed data we can draw the spiral
\foreach \ii in {1,2,...,19}{
\draw[blue] (P-\ii) -- (P-\the\numexpr\ii+1\relax);
}
\end{tikzpicture}

\end{document}


Result: