如何绘制三个与西对齐的 tikz 圆圈

如何绘制三个与西对齐的 tikz 圆圈

我尝试画出三个排列在一起的圆圈。

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, decorations.text}

\begin{document}
\begin{tikzpicture}

\node[circle, minimum size=8cm, draw, fill=pink,anchor=west] (a) {ppou};
\node[circle, minimum size=6cm, draw, fill=green,  anchor=west] (b) {oooo};
 
\node[circle, minimum size=3.6cm, draw, fill=orange, anchor=west] (c) {Inner Market};

\draw [decorate, decoration={text along path, } ] (0:7) arc (30:-70:5.5cm); 
\draw [decorate, decoration={text along path, text = Private Market } ] (0:4.5) arc (-0:-60:4.6cm);

\draw [decorate, decoration={text along path, text = Total Market}] (0:6.7) arc (0:-90:6cm); 

\end{tikzpicture}
\end{document}

我怎样才能更好地对齐外圈和中间圆圈中的文字以使其看起来更好?

在此处输入图片描述

答案1

这里还有另外两种选择供您选择:

  • 左:将另外两个(或三个)节点作为标签
  • 右:同样的想法,但锚定在南边(即使用相同的空间)

结果

做了一些重构wrt 样式,也简化了代码行:

 \begin{tikzpicture}[
    crc/.style={circle,anchor=west,draw},
    lbl/.style={align=center},
    ]
    % ~~~ cicles ~~~~~~~~~~~~~~~~~~~~~
    \node[crc, minimum size=8cm, fill=pink]     (a) {};
...

要放置标签,只需将它们相对于彩色节点移动即可,使用笛卡尔符号或极坐标表示法:

    % ... two alternatives ...........
    \node[yshift=33mm]  at (a)                  {Total Market};
    \node[lbl]          at ([shift=(30:3.0)] a) {Total\\Market};

代码

\documentclass[tikz,border=2mm]{standalone} 

\begin{document}
 \begin{tikzpicture}[
    crc/.style={circle,anchor=west,draw},
    lbl/.style={align=center},
    ]
    % ~~~ cicles ~~~~~~~~~~~~~~~~~~~~~
    \node[crc, minimum size=8cm, fill=pink]     (a) {};
    \node[crc, minimum size=6cm, fill=green,]   (b) {};
    \node[crc, minimum size=3.6cm, fill=orange] (c) {Inner Market};
    % ~~~ labels ~~~~~~~~~~~~~~~
    \node[yshift=22mm]  at (b)                  {Private Market};
    % ... two alternatives ...........
    \node[yshift=33mm]  at (a)                  {Total Market};
    \node[lbl]          at ([shift=(30:3.0)] a) {Total\\Market};
 \end{tikzpicture}
 
 \begin{tikzpicture}[
    crc/.style={circle,anchor=south,draw},
    %lbl/.style={align=center},
    ]
    % ~~~ cicles ~~~~~~~~~~~~~~~~~~~~~
    \node[crc, minimum size=8cm, fill=pink]     (a) {};
    \node[crc, minimum size=6cm, fill=green,]   (b) {};
    \node[crc, minimum size=3.6cm, fill=orange] (c) {Inner Market};
    % ~~~ labels ~~~~~~~~~~~~~~~
    \node[yshift=16mm]  at (b)                  {Private Market};
    \node[yshift=27mm]  at (a)                  {Total Market};
 \end{tikzpicture}
\end{document}

答案2

圆形样式有三个参数的短代码示例:

\documentclass[tikz,margin=3mm]{standalone}

\begin{document}
    \begin{tikzpicture}[
C/.style args = {#1/#2/#3}{circle, draw, anchor=west, minimum size=#1, fill=#2,
                           label = {[text width=4em, align=left, anchor=east]east:#3},
                           node contents={}},
                        ]
\node[C=6cm/pink/Total Market];
\node[C=4cm/green/Private Market];
\node[C=2cm/orange/Inner Market];
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

正如评论中所说,如果文本是水平的,阅读起来会更舒服。对于第二和第三个圆圈,你可以将其分成两行以留出足够的空间。对于第一个圆圈,我会保持文本原样,这样圆圈看起来就不会太空:

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, decorations.text}

\begin{document}
\begin{tikzpicture}

\node[circle, minimum size=8cm, draw, fill=pink,anchor=west] (a) {ppou};
\node[circle, minimum size=6cm, draw, fill=green,anchor=west] (b) {oooo};
\node[circle, minimum size=3.6cm, draw, fill=orange, anchor=west] (c) {Inner Market};

\node[text width=2cm,align=center] at (4.75cm,0) {Private Market};
\node[text width=2cm,align=center] at (7cm,0) {Total Market};

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容