6

In the left scope, how to automate evenly distributing the red circles along the third blue circle instead of manually drawing and shifting them; and making this third circle invisible (white).

In the right scope, how to gather the red circles around a certain point and control the distances between them to make the second and third drawings.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{bias}
\begin{minipage}{\textwidth}
{
\tikzset{pics/.cd,cc/.style={code={\draw [red, thin, fill=red] circle (0.248cm);}}}
\begin{tikzpicture}[scale=.9, transform shape]
\begin{scope}[scale=.4]
\draw[black, thick, fill=black] (0,0)node (o){} circle (0.24cm);
\draw[black, thick, dashdotted] ([shift={(-90.:5.4cm)}]o.center) -- ([shift={(90.:5.4cm)}]o.center) ([shift={(180.:5.4cm)}]o.center) -- ([shift={(0.:5.4cm)}]o.center);
\foreach \r in {1, 2,2.5,3,4,5} \draw[blue, thick] (o.center) circle (\r);
\pic at ([shift={(-90.:2.4cm)}]o.center) {cc};
\pic at ([shift={(90.:2.4cm)}]o.center) {cc};
\pic at ([shift={(170.:2.48cm)}]o.center) {cc};
\pic at ([shift={(10.:2.48cm)}]o.center) {cc};
\pic at ([shift={(45.:2.48cm)}]o.center) {cc};
\pic at ([shift={(-45.:2.48cm)}]o.center) {cc};
\pic at ([shift={(135.:2.48cm)}]o.center) {cc};
\pic at ([shift={(-135.:2.48cm)}]o.center) {cc};
\end{scope}
\begin{scope}[scale=.4, xshift=14cm]
\draw[black, thick, fill=black] (0,0)node (o){} circle (0.24cm);
\draw[black, thick, dashdotted] ([shift={(-90.:5.4cm)}]o.center) -- ([shift={(90.:5.4cm)}]o.center) ([shift={(180.:5.4cm)}]o.center) -- ([shift={(0.:5.4cm)}]o.center);
\foreach \r in {1, 2,...,5} \draw[blue, thick] (o.center) circle (\r);
\pic at ([shift={(145.:2.48cm)}]o.center) {cc};
\pic at ([shift={(156.:2.4cm)}]o.center) {cc};
\pic at ([shift={(145.:3.cm)}]o.center) {cc};
\pic at ([shift={(150.:3.6cm)}]o.center) {cc};
 \pic at ([shift={(159.:3.6cm)}]o.center) {cc};
\pic at ([shift={(168.:2.48cm)}]o.center) {cc};
\pic at ([shift={(168.:3.6cm)}]o.center) {cc};
\pic at ([shift={(168.:3.06cm)}]o.center) {cc};
\end{scope}
\end{tikzpicture}
}
\end{minipage}
\end{frame}
\end{document}

enter image description here

enter image description here

5

Is this what you are lookig for?

enter image description here

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\tikzset{pics/.cd,cc/.style={code={\draw [black, thin, fill=red] circle (0.248cm);}}}
\begin{tikzpicture}[scale=.9, transform shape]
\begin{scope}[scale=.4]
\draw[black, thick, fill=black] (0,0)node (o){} circle (0.24cm);
\draw[black, thick, dashdotted] ([shift={(-90.:5.4cm)}]o.center) -- ([shift={(90.:5.4cm)}]o.center) ([shift={(180.:5.4cm)}]o.center) -- ([shift={(0.:5.4cm)}]o.center);
\foreach \r in {1, 2,3,4,5} \draw[blue, thick] (o.center) circle (\r);
\foreach \ang in {0,45,...,315}
    \pic at (\ang:2.5cm) {cc};
\end{scope}
\begin{scope}[scale=.4, xshift=14cm]
\draw[black, thick, fill=black] (0,0)node (o){} circle (0.24cm);
\draw[black, thick, dashdotted] ([shift={(-90.:5.4cm)}]o.center) -- ([shift={(90.:5.4cm)}]o.center) ([shift={(180.:5.4cm)}]o.center) -- ([shift={(0.:5.4cm)}]o.center);
\foreach \r in {1, 2,...,5} \draw[blue, thick] (o.center) circle (\r);
\def\dist{0.7}
\coordinate (p) at (240:3cm);
\foreach \ang in {0,45,...,315}
    \pic at ([shift={(\ang:\dist)}]p) {cc};
\end{scope}
\end{tikzpicture}
\end{document}
  • Yes this is what I was looking for. Thank you very much. – Hany Dec 4 '18 at 12:00
7

A PSTricks solution only for comparison purposes.

One

\documentclass[pstricks,border=12pt]{standalone}
\pstVerb{realtime srand}
\begin{document}
\begin{pspicture}(-6,-6)(6,6)
    \qdisk(0,0){5pt}
    \foreach \i in {1,...,6}{\pscircle[linecolor=blue]{\i}}
    \foreach \i in {0,1,...,7}{\pscircle[fillstyle=solid,fillcolor=red,origin={!3 45 \i\space mul PtoC}]{5pt}}
    \psset{linestyle=dashed}    
    \psline(0,-6)(0,6)
    \psline(-6,0)(6,0)
\end{pspicture}
\end{document}

enter image description here

Two

\documentclass[pstricks,border=12pt]{standalone}
\pstVerb{realtime srand}
\begin{document}
\begin{pspicture}(-6,-6)(6,6)
    \qdisk(0,0){5pt}
    \foreach \i in {1,...,6}{\pscircle[linecolor=blue]{\i}}
    \psLoop{8}{\pscircle[fillstyle=solid,fillcolor=red,origin={-3,-2}](!Rand .5 mul Rand 360 mul PtoC){5pt}}
    \psset{linestyle=dashed}    
    \psline(0,-6)(0,6)
    \psline(-6,0)(6,0)
\end{pspicture}
\end{document}

enter image description here

Three

\documentclass[pstricks,border=12pt]{standalone}
\pstVerb{realtime srand}
\begin{document}
\begin{pspicture}(-6,-6)(6,6)
    \qdisk(0,0){5pt}
    \foreach \i in {1,...,6}{\pscircle[linecolor=blue]{\i}}
    \foreach \i in {0,1,...,7}{\pscircle[fillstyle=solid,fillcolor=red,origin={3;225}](!.5 45 \i\space mul PtoC){5pt}}
    \psset{linestyle=dashed}    
    \psline(0,-6)(0,6)
    \psline(-6,0)(6,0)
\end{pspicture}
\end{document}

enter image description here

  • Thank you for your answer. Unfortunately, for some reason, I can not compile pstricks. Would you please use tikz in Beamer class. – Hany Dec 4 '18 at 7:59
  • 1
    (0) The beautiful code. :-)) – user173875 Dec 4 '18 at 8:16
  • 3
    @Hany I think for PSTricks you need either latex+dvips + ps2pdf or xelatex or use package auto-pst-pdf with shell-escape and pdflatex. – user4686 Dec 4 '18 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.