在 LaTeX 中排版图形

在 LaTeX 中排版图形

有人知道我该如何绘制这个附图吗?

期望输出

答案1

图片只是一些多次使用的简单东西。为了简化它,我为男人和圆圈创建了命令,以使位置更清晰,并且如果需要更改这些形状,则更容易。

男人是用下面的代码创建的

\def\man#1;{%
    \begin{scope}[shift={#1}]
        \fill [rounded corners=1.5] (0,0.4) -- (0,0.8) -- (0.4,0.8) -- (0.4,0.4) --
            (0.325,0.4) -- (0.325,0.7) -- (0.3,0.7) -- (0.3,0) -- (0.225,0) --
            (0.225,0.4) -- (0.175,0.4) -- (0.175,0) -- (0.1,0) -- (0.1,0.7) --
            (0.075,0.7) -- (0.075,0.4) -- cycle;
        \fill (0.2,0.9) circle (0.1);
    \end{scope}}

调用的是\man(x,y);

这些圆圈是用

\def\shadecircle(#1)(#2);{%
    \draw [thick] (#1) circle (#2);
    \draw [thick,draw opacity=0.1] (#1) ++(0,-0.1) circle (#2);}

并被调用\shadecircle(x,y)(r);

圆圈内的标签只是用 放置的节点\draw (x,y) node {label};,箭头用

\draw [very thick,->] (startx,starty) node [label position] {label} -- (endx,endy);

所有东西都以绝对坐标放置。

完整代码如下:

\documentclass{article}

\usepackage{tikz}

\def\man#1;{%
    \begin{scope}[shift={#1}]
        \fill [rounded corners=1.5] (0,0.4) -- (0,0.8) -- (0.4,0.8) -- (0.4,0.4) --
            (0.325,0.4) -- (0.325,0.7) -- (0.3,0.7) -- (0.3,0) -- (0.225,0) --
            (0.225,0.4) -- (0.175,0.4) -- (0.175,0) -- (0.1,0) -- (0.1,0.7) --
            (0.075,0.7) -- (0.075,0.4) -- cycle;
        \fill (0.2,0.9) circle (0.1);
    \end{scope}}
\def\shadecircle(#1)(#2);{%
    \draw [thick] (#1) circle (#2);
    \draw [thick,draw opacity=0.1] (#1) ++(0,-0.1) circle (#2);}

\begin{document}

\begin{tikzpicture}

\draw [very thick] (0,0) rectangle (11,11);

\shadecircle(6,7.3)(2.8);
\shadecircle(3.2,7.5)(2.3);
\shadecircle(3.8,4)(3.5);

\draw (6,9.5) node {\textbf{List 1}};
\draw (2.7,9.1) node {\textbf{List 2}};
\draw (3.8,1.2) node {\textbf{List 3}};

\man(1.5,7.2);

\man(2.3,5.8);

\man(4,7.7);

\man(3.7,6);
\man(4.4,6.1);

\man(6,8.1);
\man(7,7.5);

\man(5.2,5);
\man(5.8,4.8);

\man(1.5,3.5);
\man(2.2,2);
\man(3.1,3.2);
\man(3.8,2.3);
\man(4.5,3.4);
\man(6,3.2);

\man(9.4,5.6);
\man(8.4,3.6);
\man(8.9,2.6);
\man(8.1,2);
\man(9.7,2.3);

\draw [very thick,->] (-0.5,6.5) node [left] {\(\mathbf{Y_{001}}\)} -- (2,6.5);
\draw [very thick,->] (-0.5,9.8) node [left] {\(\mathbf{Y_{010}}\)} -- (1.4,8.2);
\draw [very thick,->] (-0.5,4.7) node [left] {\(\mathbf{Y_{111}}\)} -- (4.2,5.9);
\draw [very thick,->] (1.5,-0.5) node [below] {\(\mathbf{Y_{001}}\)} -- (3.5,2.4);
\draw [very thick,->] (4,11.5) node [above] {\(\mathbf{Y_{110}}\)} -- (4,8.8);
\draw [very thick,->] (8,11.5) node [above] {\(\mathbf{Y_{100}}\)} -- (7,9.1);
\draw [very thick,->] (11.5,5.2) node [right] {\(\mathbf{Y_{101}}\)} -- (6.6,5.2);
\draw [very thick,->] (11.5,3.9) node [right] {\(\mathbf{Y_{000}=\,}\)\textbf?} -- (9.8,3.9);

\end{tikzpicture}

\end{document}

在此处输入图片描述


如果您对结果不满意,该代码应该很容易操作。例如,要改变男人的外观,只需更改 的定义\man。要使用外部图像,您可以使用代码

\def\man#1;{\draw #1 node {\includegraphics[width=0.5cm]{image}};}

如果你真的很有野心,你可能会使用使圆圈下的阴影变得模糊。

相关内容