我正在尝试创建一个层次金字塔,旁边有一个箭头,并将其放在右下角,以便所有内容都对齐。
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes, arrows.meta, positioning, calc, decorations.pathreplacing, intersections}
\tikzset{every picture/.style={/utils/exec={\sffamily\small}}}
\tikzstyle{textbox} = [rectangle, minimum width = 3.5cm, minimum height = 1cm, rounded corners = 1pt, line width = 1pt, draw = black, align = center]
\tikzstyle{curlyBrace} = [decorate, decoration = {brace, amplitude = 15pt, raise = 2pt}, line width = 1pt, line cap = round]
\tikzstyle{arrow} = [solid, line width = 5pt, -{Triangle[width = 10pt, length = 10pt]}]
\tikzstyle{singleArrow} = [single arrow, minimum width = 1cm, minimum height = 4cm, draw = black, line width = 1pt]
\begin{document}
\begin{tikzpicture}[node distance = 1cm and 1cm, outer sep = 0]
\node [textbox] (hut) {hut};
\node [textbox, right = of hut] (fuss) {fuss};
\node [textbox, right = of fuss] (maus) {maus};
\node [textbox, below = 2cm of hut.west, anchor = west, minimum width = 8cm] (tao) {tao};
\node [textbox, below = 2cm of tao.west, anchor = west, minimum width = 12.5cm] (toll) {toll};
\node [textbox, below = 2cm of toll.west, anchor = west] (wer) {wer)};
\node [textbox, below = 2cm of wer.west, anchor = west] (mode) {mode};
\draw [curlyBrace] (wer.north east) -- (mode.south east);
\coordinate (A) at (6,0) {};
\coordinate (B) at (14,0) {};
\coordinate (C) at (10,4) {};
\draw[name path = AC, line width = 1pt] (A) -- (C);
\draw[name path = BC, line width = 1pt] (B) -- (C);
\foreach \y/\A in
{0/{Hardware/Software/Bauteil},
1/{System/Fahrzeugbereich},
2/Fahrzeugmodell} {
\path[name path = horiz] (A|-0,\y) -- (B|-0,\y);
\draw[line width = 1pt, name intersections = {of = AC and horiz, by = P},
name intersections = {of = BC and horiz, by = Q}] (P) -- (Q)
node[midway, above] {\A};
}
\node [singleArrow, anchor = east, rotate = 270] at (15,0) {Detailgrad};
\end{tikzpicture}
\end{document}
我怎样才能将金字塔和旁边的箭头放在右下角“收费”框的正下方,以使一切都对齐?
编辑:添加了所需结果的示例图像。
答案1
期望的图像应该是这样的吗:
生成上述图像的 MWE 部分基于您的 MWE 代码,以及来自我的代码的少量修改回答 关于你之前的问题:
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc,
decorations.pathreplacing,%
calligraphy,% had to be loaded after decorations.pathreplacing
intersections,
positioning,
shapes}
\tikzset{
every picture/.style = {font=\sffamily\small, outer sep=0pt, line width=1pt},
arr/.style = {-{Triangle[width=10pt, length=10pt]}, line width=5pt},% it is not used
BC/.style = {decorate,
decoration={calligraphic brace, amplitude=6pt,
raise=2mm},
very thick,
pen colour=black
},
box/.style = {draw, rounded corners = 1pt,
minimum width = 21mm, minimum height = 7mm, inner sep=2mm,
align = center},
SA/.style = {single arrow, draw,
minimum width = 1cm, minimum height = 4cm}
}
\begin{document}
\begin{tikzpicture}[
node distance = 4mm and 6mm
]
\begin{scope}[nodes=box]
\node (hut) {hut};
\node [right = of hut] (fuss) {fuss};
\node [right = of fuss] (maus) {maus};
%
\node [below right = 4mm and 0mm of hut.south west,
minimum width = 50mm] (tao) {tao};
\node [below right = 4mm and 0mm of tao.south west,
minimum width = 76mm] (toll) {toll};
%
\node [below = of hut |- toll.south] (wer) {wer};
\node [below = of wer] (mode) {mode};
\end{scope}
\draw [BC] (wer.north east) -- (mode.south east);
% pyramid, positioned relative to nodes "toll"
\coordinate[right=of toll.south east] (A);
\coordinate[right=6cm of A] (B);
\coordinate[above=4cm of $(A)!0.5!(B)$] (C);
% copy of my answer on the your previous question
\draw[name path = AB] (A) -- (C) -- (B);
%%
\foreach \y/\T in { 0/{Hardware/Software/Bauteil},
1/{System/Fahrzeugbereich},
2/Fahrzeugmodell}
{
\path [name path = H] ([yshift=\y cm] A) -- node [above, ] {\T} ([yshift=\y cm] B); % modified
\draw[name intersections = {of = AB and H, by = {p1\y,p2\y}}]
(p1\y) -- (p2\y);
}
%%% single arrow
\node [SA, rotate=270, right=6mm, anchor=east] at (B) {Detailgrad};
\end{tikzpicture}
\end{document}
抱歉,但你的问题不是很清楚(对我来说),金字塔和单箭头应该放在哪里。但是,上面的 MWE 中的代码允许轻松调整它的位置。例如,如果你想让它们的底部与图像的底部对齐,你只需要确定坐标 A 为:
% pyramid, positioned relative to nodes "toll" and "mode"
\coordinate[right=of toll.east |- mode.south] (A);
在这种情况下,生成的图像是:
注意:我擅自将节点和金字塔定义得稍微小一些,以便现在可以放在页面上。