I interpreted the question a bit differently: cycle the colors of the dots and let the color in the left graph at a certain angle correspond to the color in the right plot at that angle.
For this I wrote a small color cycle command that goes through a predefined list of colors. It uses two counters, one global counter for the current color index and one local counter in a loop. It also uses a boolean to check if a color is assigned at the end of the loop, if not then the global counter is larger than the length of the list and should be reset to 0.
The next color is computed at the start of the \foreach
body in the tikzpictures
, and the global counter is increased at the end of the \foreach
body.
MWE (note that I reduced the number of points in the polar plot to match the angles):
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz,tikz-3dplot}
\newcounter{clridx}
\newcounter{cllistloop}
\newif\ifclrfound
\makeatletter
\newcommand{\getnextcolor}{%
\setcounter{cllistloop}{0}
\clrfoundfalse
% loop list from 0 until list index = current color index
% at this index define \currcolor and set found to true
\@for\next:=\plotcolors\do{\ifnum\value{cllistloop}=\value{clridx}\xdef\currcolor{\next}\clrfoundtrue\fi\stepcounter{cllistloop}}
% if nothing found: cycle current color to 0 and call lookup function again
\ifclrfound\relax\else\setcounter{clridx}{0}\getnextcolor\fi
}
\makeatother
\begin{document}
% cycle list for colors
\def\plotcolors{red,yellow,green,cyan,blue,violet}
% current color index
\setcounter{clridx}{0}
\begin{tikzpicture}[thick]
\draw[lightgray, dotted, xstep=pi/6, ystep=1] (0,0) grid (2*pi,2);
\draw[gray] (0,0)--(2*pi,0) node[above] {$x$};
\draw[gray] (0,0)--(0,2) node[left] {$y$};
\draw[domain=0:2*pi,samples=100] plot (\x,{1+sin(\x r)});
\foreach \ang in {0,30,60,...,361} { \getnextcolor\filldraw[\currcolor] (\ang /180*pi ,{1+sin(\ang )}) circle (2pt);\stepcounter{clridx}}
\end{tikzpicture}
\begin{tikzpicture}[thick]
% reset color index for new plot
\setcounter{clridx}{0}
\foreach \ang in {0,...,12} { \draw [lightgray] (0,0) -- (\ang * 180 / 6:2.1);}
\foreach \s in {1, 1.5, 2} {\draw [lightgray] (0,0) circle (\s );}
\draw[domain=0:2*pi,samples=100] plot ({deg(\x)}:{1+sin(\x r)});
\foreach \ang in {0,...,12} { \getnextcolor\filldraw[\currcolor] (\ang * 180 / 6:{1+sin(\ang * 180 / 6 )}) circle (2pt);\stepcounter{clridx}}
\end{tikzpicture}
\end{document}
Result: