我正在尝试构建网络结构(图表)。我使用以下命令:
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\tikzstyle{block} = [rectangle, draw=blue, thick, fill=blue!20,
text width=5em, text centered, rounded corners]
\tikzstyle{line} = [draw, -latex’]
\tikzstyle{cloud} = [draw=red, thick, ellipse,fill=red!20, minimum height=8em];
\matrix [column sep=6mm,row sep=10mm]
{
% row 1
& &
\node [block] (init) {Lack of information}; &
\\
% row 2
& & & & & \\
% row 3
& &
\node [block] (identify) {Perceptions about Nato's presence}; & \\
% row 3
\node [block] (update) {Positive perceptions}; &
& & &
\node [block] (evaluate) {Negative perceptions}; & \\
% row 4
\node [block] (decide) {Desirable presence}; &
& & &
\node [block] (evaluate) {Non-desirable presence}; & \\
% row 5
& & & & & \\
% row 6
\node [block] (stop) {Efficient presence}; &
\node [block] (stop) {Useless presence}; &
\node [block] (stop) {Service to others’ interests}; &
\node [block] (stop) {No institutional role}; &
\node [block] (stop) {Inefficient presence}; &\\
};
%arrows
\end{tikzpicture}
\end{center}
\end{figure}
我的问题是我不知道如何用线连接我的一些节点。我尝试使用命令:\pathline--(); 但它不起作用。
什么是假的?
先感谢您
答案1
欢迎使用 TeX.SE!有几种绘制箭头的选项:
\draw[line] (init) -- (identify);
line
将从节点绘制一条样式线init
来“识别”。- 或者,将从节点
\draw (identify) edge[line] (update);
绘制一条线样式来`更新。line
identify
- 如果您厌倦了总是指定样式,那么您可以使用在范围内绘制边缘
every edge/.style={line}
。 - 为了能够绘制指向所有节点的箭头,您需要为它们赋予唯一的名称。但是,您命名了一堆节点
stop
。
以下是符合本网站惯例的代码:以 开头\documentclass
,以 结尾\end{document}
,可以编译。请考虑在将来发布此类文档。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,arrows}
\begin{document}
\begin{tikzpicture}
\tikzset{block/.style={rectangle, draw=blue, thick, fill=blue!20,
text width=5em, text centered, rounded corners},
line/.style={draw, -latex'},
cloud/.style={draw=red, thick, ellipse,fill=red!20, minimum height=8em}}
\matrix [column sep=6mm,row sep=10mm]
{
% row 1
& &
\node [block] (init) {Lack of information}; &
\\
% row 2
& & & & & \\
% row 3
& &
\node [block] (identify) {Perceptions about Nato's presence}; & \\
% row 3
\node [block] (update) {Positive perceptions}; &
& & &
\node [block] (evaluate) {Negative perceptions}; & \\
% row 4
\node [block] (decide) {Desirable presence}; &
& & &
\node [block] (evaluate) {Non-desirable presence}; & \\
% row 5
& & & & & \\
% row 6 : give nodes uique names
\node [block] (stop1) {Efficient presence}; &
\node [block] (stop2) {Useless presence}; &
\node [block] (stop3) {Service to others' interests}; &
\node [block] (stop4) {No institutional role}; &
\node [block] (stop5) {Inefficient presence}; &\\
};
%arrows
\draw[line] (init) -- (identify);
\draw (identify) edge[line] (update);
\begin{scope}[every edge/.style={line}]
\draw (identify) edge (evaluate)
(evaluate) edge (stop1);
\end{scope}
\end{tikzpicture}
\end{document}