2

I want to draw 10 circles in a circular shape, inside a rectangle.

The problem is that the 10 circles are positioned as an ellipse, and not around the circumference of a circle.

I want to place the 10 circles in a relative way to this rectangle; that's why I used the scope (maybe I will change in the future the rectangle size and the also the radius of the circle, also relative in size to the rectangle's dimensions).

So I used this answer, to create the following:

enter image description here

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}

\node (frame) [ anchor=south west, inner sep=0,outer sep=0pt, draw,very thick, minimum width = 4cm, minimum height = 1cm ] at (0,0) {}; \begin{scope}[x={(frame.south east)},y={(frame.north west)}] \foreach \i in {1,2,...,10} \filldraw ($ ({360/10*\i}:0.1) + (0.2,0.8) $) circle (1pt);

\end{scope} \end{tikzpicture}

\end{document}

The problem is that the axes inside the scope are not orthogonal anymore; the unit vectors' are not equal in magnitude, as pointed out here.

But how can I fix it?

I added inner sep=0 and outer sep=0 but it doesn't seem to have any effect.

tush
  • 1,115

1 Answers1

4
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\newcommand{\rectw}{4}
\newcommand{\recth}{1}
\newcommand{\radi}{0.2}
\node[
draw, very thick,
minimum width=\rectw cm, minimum height=\recth cm,
] (frame) at (0,0) {};
\foreach \i in {1,2,...,10}
\fill ([shift={(-1,0.2)}]frame.center) +(360/10*\i:\radi) circle[radius=1pt];
\end{tikzpicture}
\end{document}

Rectangle with a circle of dots