我对 LaTeX 还比较陌生,需要这张图表作为我的本科毕业论文。我尝试使用 TikZ 制作它,但我只设法创建了块和一些输入和输出参数。我该如何制作其余部分并为其着色。它一定不能有那些用于控制参数的小圆圈。它们可以用其他东西代替。
谢谢!
我尝试制作输入和输出参数。如何使箭头更长?
\coordinate[above left =of mlb.west] (a1);
\coordinate[below = of a1] (a2);
\coordinate[above right =of mlb.east] (b1);
\coordinate[below = of b1] (b2);
\foreach \i [count=\xi from 1] in {X,Y}
\draw[L] (a\xi) node[left] {\i} -- (a\xi-| mlb.west);
\foreach \i [count=\xi from 1] in {A,B}
\draw[L] (mlb.east |- b\xi) -- (b\xi) node[right] {\i};
答案1
由于您是初学者(至少在这个网站上),我将展示(可能的)绘制图像的起点。从这里(在我看来)完成您的图像非常简单。如果您陷入困境,请提出新问题...
\documentclass[tikz,
border=3mm]{standalone}
\usetikzlibrary{arrows.meta,
backgrounds,
calc,chains,
fit,
positioning,
}
\begin{document}
\begin{tikzpicture}[
node distance = 3mm and 2mm,
start chain = going right,
% nodes definitions
P/.style = {% Parameters circles
circle, draw, fill=white,
minimum size=5mm, inner sep=0pt, outer sep=0pt,
node distance=0pt, node contents={}, on chain},
F/.style = {% Fit box
draw, dashed, inner xsep=1mm, inner ysep=0mm, yshift=2.5mm},
% lines/arrows definition
L/.style = {-Stealth, thick}
]
% parameters circles
\foreach \i in {1,...,5}{\node (n\i) [P];}
% MLB box
% it width is length from west side to east side of P nodes
\path let \p1 = (n1.west),
\p2 = (n5.east),
\n1 = {veclen(\x2-\x1,\y2-\y1)} in
node (mlb) [minimum width=\n1, inner ysep=5mm,
draw, font=\Huge\bfseries,
below=0mm of n3] {MLB};
% control parameters
\begin{scope}[inner ysep=1pt]
\node (n11) [above left =of n1 ] {Max\_Load@TeNB};
\node (n12) [above =of n11] {xxxxxxxxxxxxxx};
\node (n13) [above=of n12.north -| n3] {Max\_Load};
\node (n15) [above right=of n5 ] {xxxxxxxxxxxxxx};
\node (n14) [above =of n15] {xxxxxxxxxxxxxx};
% parameters title
\node (n16) [above left=of n1.west |- n13,
font=\large\bfseries] {Control Parameter};
\end{scope}
% frame around parameters lie on background layer
\scoped[on background layer]
\node [F, fit=(n1) (n16.west) (n14)] {};
% lines
\draw[L] (n11) -| (n1);
\draw[L] (n12) -| (n2);
\draw[L] (n13) -- (n3);
\draw[L] (n14) -| (n4);
\draw[L] (n15) -| (n5);
\end{tikzpicture}
\end{document}
编辑: 由于到目前为止还没有回应,看来完成图像的步骤是高度:-)
让我们考虑输入参数(在 MLD 的左侧)。文本距离 MLD 节点左侧约 1cm,周围的虚线位置与控制参数周围的位置略有不同。为此,更改节点距离和一些 F 形选项是明智的。考虑到这一点,输入选项可以写成:
\begin{scope}[node distance=0mm and 9mm,
F/.append style={inner ysep=1mm,yshift=-1mm} ]
\node (n21) [above left=of mlb.west] {Cell Load};
\node (n22) [below left=of mlb.west] {UE Measurements};
\node (n23) [below left=of mlb.west |- n22.south,
font=\bfseries] {Input Parameters};
\node [F, fit=(n21.east) (n23)] {};
\end{scope}
% coordinate (n21 -| mlb.west) is projection of n21.east on the west border of mlb node
\draw[L] (n21) -- (n21 -| mlb.west);
\draw[L] (n22) -- (n22 -| mlb.west);
考虑上述 MWE 中增加的彩色 MLB 节点,得出:
\documentclass[tikz,
border=3mm]{standalone}
\usetikzlibrary{arrows.meta,
backgrounds,
calc,chains,
fit,
positioning,
}
\begin{document}
\begin{tikzpicture}[
node distance = 3mm and 2mm,
start chain = going right,
% nodes definitions
P/.style = {% Parameters circles
circle, draw, fill=white,
minimum size=5mm, inner sep=0pt, outer sep=0pt,
node distance=0pt, node contents={}, on chain},
F/.style = {% Fit box
draw, dashed, inner xsep=1mm, inner ysep=0mm, yshift=2.5mm},
% lines/arrows definition
L/.style = {-Stealth, thick}
]
% parameters circles
\foreach \i in {1,...,5}{\node (n\i) [P];}
% MLB box
% it width is length from west side to east side of P nodes
\path let \p1 = (n1.west),
\p2 = (n5.east),
\n1 = {veclen(\x2-\x1,\y2-\y1)} in
node (mlb) [minimum width=\n1, inner ysep=5mm,
draw, font=\Huge\bfseries,
top color=white, bottom color=gray!50, middle color=gray!15, % added colors to shape
below=0mm of n3] {MLB};
% control parameters
\begin{scope}[inner ysep=1pt]
\node (n11) [above left =of n1 ] {Max\_Load@TeNB};
\node (n12) [above =of n11] {xxxxxxxxxxxxxx};
\node (n13) [above=of n12.north -| n3] {Max\_Load};
\node (n15) [above right=of n5 ] {xxxxxxxxxxxxxx};
\node (n14) [above =of n15] {xxxxxxxxxxxxxx};
% parameters title
\node (n16) [above left=of n1.west |- n13,
font=\large\bfseries] {Control Parameter};
\end{scope}
% frame around parameters lie on background layer
\scoped[on background layer]
\node [F, fit=(n1) (n16.west) (n14)] {};
% lines
\draw[L] (n11) -| (n1);
\draw[L] (n12) -| (n2);
\draw[L] (n13) -- (n3);
\draw[L] (n14) -| (n4);
\draw[L] (n15) -| (n5);
\begin{scope}[node distance=0mm and 9mm,
F/.append style={inner ysep=1mm,yshift=-1mm} ]
\node (n21) [above left=of mlb.west] {Cell Load};
\node (n22) [below left=of mlb.west] {UE Measurements};
\node (n23) [below left=of mlb.west |- n22.south,
font=\bfseries] {Input Parameters};
\node [F, fit=(n21.east) (n23)] {};
\end{scope}
% coordinate (n21 -| mlb.west) is projection of n21.east on the west border of mlb node
\draw[L] (n21) -- (n21 -| mlb.west);
\draw[L] (n22) -- (n22 -| mlb.west); \end{tikzpicture}
\end{document}