# Displaying circles in sequence from the same central point

I would like to draw concentric circles that are displayed in sequence.

When applying the following code, the circles appear to move from the top edge downwards as each circle is displayed.

How to avoid this and make them displayed on top of each other from the same centre coordinate as in this diagram.

\documentclass{beamer}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{tkz-fct}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\begin {center}
\begin{tikzpicture}[scale=.9, transform shape]
\only<1,5>
{
\node[circle, outer color=yellow!60!green, inner color=white, minimum width=5cm] (radial) at (4,0) {};
\fill[pattern=dots,pattern color = black] (3.6,-.4) -- + +(.8,0) -- ++ (0,.8) -- ++(-.8,0) -- cycle;
}
\only<4-5>
{
\node[circle, outer color=green!80!purple, inner color=purple, minimum width=4cm] (radial) at (4,0) {};
}
\only<3-5>
{
\node[circle, outer color=purple, inner color=purple!20!red, minimum width=3cm] (radial) at (4,0) {};
}
\only<2-5>
{
\node[circle, outer color=purple, inner color=purple!50!black, minimum width=2cm] (radial) at (4,0) {};
}
\end{tikzpicture}
\end {center}
\end{frame}
\end{document}


a rude solution is add to each slide invisible circle with minimum size of the greatest one:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}[fragile,t]
\frametitle{Circles \dots}
\begin {center}
\begin{tikzpicture}[scale=.9,
circ/.style args = {#1/#2/#3}{circle,outer color=#1, inner color=#2, minimum width=#3,
node contents={}},
]
\only<1,5>
{
\node[circ=yellow!60!green/white/5cm];
\fill[pattern=dots,pattern color = black] (-0.4,-0.4) rectangle + (0.8,0.8);
}
\only<4-5>
{
\node[circle, minimum size=5cm] {};
\node[circ=green!80!purple/purple/4cm];
}
\only<3-5>
{
\node[circle, minimum size=5cm] {};
\node[circ=purple/purple!20!red/3cm];
}
\only<2-5>
{
\node[circle, minimum size=5cm] {};
\node[circ=purple/purple!50!black/2cm];
}
\end{tikzpicture}
\end {center}
\end{frame}
\end{document}


note:

• coordinates in tikzpicure are relative to picture, not to slide. therefore in your case at (4,0) gives the same result as at (0,0) or if you omit explicit notation of coordinates.
• for determining coordinate on absolute position on slide, you need to use remember picture, overlay:

\documentclass{beamer}
\usepackage{tikz}
overlay-beamer-styles}

\begin{document}
\begin{frame}[fragile,t]
\frametitle{Circles \dots}
\begin{tikzpicture}[remember picture,overlay,
circ/.style args = {#1/#2/#3}{circle,outer color=#1, inner color=#2, minimum width=#3},
]
\only<1,5>
{
\node[circ=yellow!60!green/white/5cm] (center) at (current page.center) {};
\fill[pattern=dots,pattern color = black]
($(current page.center)+(-0.4,-0.4)$) rectangle + (0.8,0.8);
}
\only<4-5>
{
\node[circ=green!80!purple/purple/4cm] at (center) {};
}
\only<3-5>
{
\node[circ=purple/purple!20!red/3cm] at (center) {};;
}
\only<2-5>
{
\node[circ=purple/purple!50!black/2cm] at (center) {};;
}
\end{tikzpicture}
\end{frame}
\end{document}


• +1. Very good the answer and the question. – Sebastiano Jul 29 '18 at 7:51
• Thank you very much for your answer. Just one more comment please. How to use remember picture, overlay in your code to make the drawings centered vertically and horizontally on the slides. – Hany Jul 29 '18 at 8:12
• @Sebastiano, thank you very much! now i succeed to finish answer. – Zarko Jul 29 '18 at 8:13
• @Hany, see edited answer. i had problems with uploading image so i provide complete answer in more steps. sorry for any inconvenience. – Zarko Jul 29 '18 at 8:15

A less rude solution with the beamer-overlay-styles library.

\documentclass{beamer}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{tkz-fct}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{Circles with the \texttt{overlay-beamer-styles} library}
\begin {center}
\begin{tikzpicture}[scale=.9, transform shape]
\node[visible on=<{1,5}>,circle, outer color=yellow!60!green, inner color=white, minimum width=5cm] (radial) at (4,0) {};
\fill[visible on=<{1,5}>,pattern=dots,pattern color = black] (3.6,-.4) -- + +(.8,0) -- ++ (0,.8) -- ++(-.8,0) -- cycle;
\node[visible on=<{4-5}>,circle, outer color=green!80!purple, inner color=purple, minimum width=4cm] (radial) at (4,0) {};
\node[visible on=<{3-5}>,circle, outer color=purple, inner color=purple!20!red, minimum width=3cm] (radial) at (4,0) {};
\node[visible on=<{2-5}>,circle, outer color=purple, inner color=purple!50!black, minimum width=2cm] (radial) at (4,0) {};
\end{tikzpicture}
\end {center}
\end{frame}
\end{document}


• The \usetikzlibrary{overlay-beamer-styles} is not recognized!!! – Hany Jul 29 '18 at 8:22
• @Hany What do you mean by "not recognized"? It is part of the standard TeX distributions. If you installed a smaller version, perhaps you need to install it with your package manager. And you can also find it here. This library is taylor-made for your problem, I think. – user121799 Jul 29 '18 at 8:24
• @marmot, how you manage to provide "animation" of slides. (showing sequence of them as at presentation}. i sow may your answers with this "trick" and sometimes (as at this question) this is very useful. i like to learn it :-) +1 for it! – Zarko Jul 29 '18 at 8:36
• @Zarko I use the conversion chain of this nice answer by AlexG ;-) – user121799 Jul 29 '18 at 8:37
• @Hany Did you install it with some package manager or just download? In the latter case you may need to copy the TeX file tikzlibraryoverlay-beamer-styles.code.tex in the same directory as the main file. However, the cleaner way is to install. – user121799 Jul 29 '18 at 8:43