CPM AON 图 lateX

CPM AON 图 lateX

我想在 lateX 上表示 AON(节点上活动)图。如何用这些部分实现一个圆圈?我是 lateX 新手。

在此处输入图片描述

答案1

这应该可以让你开始

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\begin{scope}[shift={(1,1)}]% move entire scope.
  \clip circle[radius=1.5cm];
  \fill[yellow] (-2,-2) rectangle (2,2);
  \draw (-2,0)--(2,0)
        (-0.5,-2) rectangle (0.5,2);
  \path (150:1cm) node{A}% polar coordinates
        (90:1) node{B}
        (30:1) node{C}
        (210:1) node{D}
        (270:1) node{E}
        (330:1) node{F};
\end{scope}
\end{tikzpicture}

\end{document}

答案2

欢迎来到 TeX.SE!!!

这是另一个 TiZ 版本,使用\pic带有不同标签的圆圈。

\documentclass[tikz]{standalone}

% colors
\definecolor{mygray}{HTML}{404040}
\definecolor{node1} {HTML}{FFD980}
\definecolor{node2} {HTML}{F09415}
\definecolor{node3} {HTML}{FCC77E}
\definecolor{node5} {HTML}{C1B56B}
\definecolor{node6} {HTML}{CA8C02}

\tikzset
{
  pics/aon/.style n args={6}{% labels starting on top, anti-clockwise
      code={%
        \def\r{1.5}   % circle radius
        \begin{scope}
          \clip (0,0) circle (\r);
          \filldraw[fill=node1] (-\r/3,-\r) rectangle ( \r/3, \r);
          \filldraw[fill=node2] (-\r,0)     rectangle (-\r/3, \r);
          \filldraw[fill=node3] (-\r,0)     rectangle (-\r/3,-\r);
          \filldraw[fill=node5] ( \r,0)     rectangle ( \r/3,-\r);
          \filldraw[fill=node6] ( \r,0)     rectangle ( \r/3, \r);
        \end{scope}
        \node[draw,circle,minimum size=2*\r cm] (-O) at (0,0) {};
        \node at ( 0     , 0.7*\r) {#1};
        \node at (-2*\r/3, 0.3*\r) {#2};
        \node at (-2*\r/3,-0.3*\r) {#3};
        \node at ( 0     ,-0.7*\r) {#4};
        \node at ( 2*\r/3,-0.3*\r) {#5};
        \node at ( 2*\r/3, 0.3*\r) {#6};
    }},
}

\begin{document}\bfseries
\begin{tikzpicture}
  \fill[mygray] (-2.2,-2.2) rectangle (5.2,5.2);
  \pic [white,ultra thick] (A) at (0,0) {aon={\slshape Start}{0}{0}{0}{0}{0}};
  \pic [white,ultra thick] (B) at (3,3) {aon={\slshape A}    {0}{0}{2}{2}{2}};
  \draw[line width=1mm,red,-latex,] (A-O) -- (B-O);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容