如何在乳胶中制作相同大小的椭圆

如何在乳胶中制作相同大小的椭圆

我希望有人能帮助我。如何让两个椭圆具有相同的大小?

我附上了代码和我希望它看起来的图像

\begin{tikzpicture}
  \node (1) at (0,0) {1};\filldraw(1.east) circle (1pt);
  \node (2) [below of = 1] {2};\filldraw(2.east) circle (1pt);
  \node (3) [below of = 2 ] {3};\filldraw(3.east) circle (1pt);
  \node (4) [below  of=  3] {4};\filldraw(4.east) circle (1pt);
  \node[fit = (1) (2) (3) (4) , ellipse, draw=blue, minimum width =2cm,thick, label=below:\(A\)]{};
 
 \node (1_1) at (3,0) {1};\filldraw(1_1.west) circle (1pt);
 \node (2_2) [below of=1_1] {2};\filldraw(2_2.west) circle (1pt);
 \node (3_3) [below of=2_2] {3};\filldraw(3_3.west) circle (1pt);
 \node[fit = (1_1) (2_2) (3_3) , ellipse, draw=blue, minimum width =2cm,thick,label=below:\(B\)]{};
 
 \draw[->, shorten >=.1cm, stealth] (1.east) to (1_1.west);
 \draw[->, shorten >=.1cm, stealth] (2.east) to (3_3.west);
 \draw[->, shorten >=.1cm, stealth] (3.east) to (2_2.west);
 \draw[->, shorten >=.1cm, stealth] (4.east) to (1_1.west);

\end{tikzpicture}

在此处输入图片描述

答案1

大小相同的椭圆

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fit,shapes,positioning}

\begin{document}
    \begin{tikzpicture}[node distance = 8mm,ell/.style={ellipse, draw=blue,thick,minimum height=6cm, minimum width=25mm, inner sep=0pt}]
      \node (1) at (0,0) {1};\filldraw(1.east) circle (1pt);
      \node (2) [below = of 1] {2};\filldraw(2.east) circle (1pt);
      \node (3) [below = of 2 ] {3};\filldraw(3.east) circle (1pt);
      \node (4) [below = of 3] {4};\filldraw(4.east) circle (1pt);
      \node[ell,fit = (1) (2) (3) (4) ,label=below:\(A\)]{};
     
     \node (1_1) at (4,0) {1};\filldraw(1_1.west) circle (1pt);
     \node (2_2) [below = of 1_1] {2};\filldraw(2_2.west) circle (1pt);
     \node (3_3) [below = of 2_2] {3};\filldraw(3_3.west) circle (1pt);
     \node (4_4) [below = of 3_3] {\vphantom{4}};
     \node[ell,fit = (1_1) (2_2) (3_3) (4_4),label=below:\(B\)]{};
     
     \draw[->, shorten >=.1cm] (1.east) to (1_1.west);
     \draw[->, shorten >=.1cm] (2.east) to (3_3.west);
     \draw[->, shorten >=.1cm] (3.east) to (2_2.west);
     \draw[->, shorten >=.1cm] (4.east) to (1_1.west);
    
    \end{tikzpicture}
\end{document}

答案2

节点fit通常放置在它所覆盖的节点周围,但参考节点仅定义它们的大小,因为位置可以是任意的。这就是以下代码中显示的内容。两个椭圆都使用相同的fit节点集合定义,这意味着它们将具有相同的尺寸,但第二个椭圆放置在右侧节点周围。这样就不需要像minimum height其他解决方案中提出的那样修复。

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{fit, shapes.geometric, positioning, arrows.meta}

\begin{document}

\begin{tikzpicture}[> = Stealth]
  \node (1) at (0,0) {1};\filldraw(1.east) circle (1pt);
  \node (2) [below of = 1] {2};\filldraw(2.east) circle (1pt);
  \node (3) [below of = 2 ] {3};\filldraw(3.east) circle (1pt);
  \node (4) [below  of=  3] {4};\filldraw(4.east) circle (1pt);
  \node[fit = (1) (4) , ellipse, draw=blue, thick, minimum width=2cm, label=below:\(A\)] (A){};
 
 \node (1_1) at (3,-0.5) {1};\filldraw(1_1.west) circle (1pt);
 \node (2_2) [below of=1_1] {2};\filldraw(2_2.west) circle (1pt);
 \node (3_3) [below of=2_2] {3};\filldraw(3_3.west) circle (1pt);
 \node[fit = (1) (4), ellipse, draw=blue, thick, minimum width=2cm, label=below:\(B\), anchor=south] at (A.south-|1_1){};
 
 \draw[->, shorten >=.1cm] (1.east) to (1_1.west);
 \draw[->, shorten >=.1cm] (2.east) to (3_3.west);
 \draw[->, shorten >=.1cm] (3.east) to (2_2.west);
 \draw[->, shorten >=.1cm] (4.east) to (1_1.west);

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

  • 两个椭圆的尺寸已经相同。最终可以稍微缩小一点(如下面 MWE 中所做的那样)。
  • 为所有图像元素定义通用样式是明智的
  • 使用chains库使图像代码更短一些
\documentclass[tikz,border=3.141592]{standalone}
\usetikzlibrary{arrows.meta,
                calc, chains, 
                fit,
                positioning,
                shapes}

\begin{document}
    \begin{tikzpicture}[
node distance = 8mm and 32mm,
  start chain = A going below,
  start chain = B going below,
   arr/.style = {draw, -Stealth}, 
   dot/.style = {circle, fill, inner sep=2pt, outer sep=1pt,
                 node contents={},
                 label=#1},
   ell/.style = {ellipse, draw=blue, thick,
                 minimum height=55mm, minimum width=20mm, inner sep=0pt,
                 node contents={},
                 fit=#1}
                        ]
\foreach \i in {1,2,3,4}                    
   \node (a\i) [dot=left:\i, on chain=A];
\node[ell = (a1)(a4),label=below:$A$];
%
   \node (b1) [dot=right:1, 
               right=of $(a1)!0.5!(a2)$,
               on chain=B
               ];
\foreach \i in {2,3}
   \node (b\i) [dot=right:\i, on chain=B];
\node[ell = (b1)(b3),label=below:$B$];
%%
\draw[arr]  (a1) edge (b2)
            (a2) edge (b3)
            (a3) edge (b2)
            (a4) edge (b1);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容