我想在我的论文中写出以下章节图。但是我该如何在 latex 中写下这样的图表?
先感谢您。
我输入了此代码,但是无法写对角箭头。
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{tikzpicture}[node distance=1cm, auto,]
% Nodes
\node (21) {2.1};
\node[right=of 21] (51) {5.1};
\node[right=of 51] (22a) {2.2};
\node[above=of 22a] (22) {2.2};
\node[right=of 22] (23) {2.3};
\node[right=of 23] (24) {2.4};
\node[right=of 24] (31) {3.1};
\node[right=of 31] (32) {3.2};
\node[right=of 32] (33) {3.3};
\node[above=of 31] (41) {4.1};
\node[right=of 41] (42) {4.2};
\node[right=of 42] (43) {4.3};
\node[above=of 24] (25) {2.5};
% Arrows
\draw[->] (21) -- (51);
\draw[->] (51) -- (22a);
\draw[->] (22a) -- (22);
\draw[->] (22) -- (23);
\draw[->] (23) -- (24);
\draw[->] (24) -- (31);
\draw[->] (31) -- (32);
\draw[->] (32) -- (33);
\draw[->] (31) -- (41);
\draw[->] (41) -- (42);
\draw[->] (42) -- (43);
\draw[->] (24) -- (25);
\end{tikzpicture}
答案1
这是一种实现此方法的方法,其中有一些变化可以激发您的灵感,并且忽略您的(22a)
:
除非你真的想要像曲轴一样的定位,否则关键似乎是:
- 首先关注主路径(2.1 .. 3.3)
- 根据需要放置对角线元素,这里通过定位,而
xshift
等也是选项,请参阅我的评论 - 绘图也是一样:先画主链,然后画侧链
为了给你提供更多的想法,我介绍了这些变化,这些变化可能会或可能不会对你的论文的读者有所帮助:
- 我认为箭头更漂亮
>={Stealth},
- 虚线和点线
- 彩色线条
- 线旁边的一些标签
\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
\begin{tikzpicture}[
node distance=1cm, auto,
>={Stealth},
]
% ~~~ Nodes, left to right = main path ~~~
\node (21) {2.1};
\node[right=of 21] (51) {5.1};
\node[right=of 51] (23) {2.3};
\node[right=of 23] (24) {2.4};
\node[right=of 24] (31) {3.1};
\node[right=of 31] (32) {3.2};
\node[right=of 32] (33) {3.3};
% ~~~ 2.2. chains ~~~~~~~
\node[below=of 51] (22) {2.2};
\node[above=of 24] (25) {2.5};
% ~~~↑ 4.x chain ~~~~~~~~~~~
\node[above=of 32] (41) {4.1};
\node[right=of 41] (42) {4.2};
\node[right=of 42] (43) {4.3};
% ~~~ Arrows, main path ~~~~~~~
\draw[->] (21) -- (51);
\draw[->] (51) -- (23);
\draw[->] (23) -- (24);
\draw[->] (24) -- (31);
\draw[->] (31) -- (32);
\draw[->] (32) -- (33);
% ~~~ 2.x chain, with some variation ~~~~~~~
\draw[->,dashed] (22) -- node[right,pos=.3] {good reason} (23);
\draw[->,dotted] (23) -- (25);
% ~~~ 4.x chain, with some variation ~~~
\draw[->,red] (31) -- (41);
\draw[->,blue] (41) -- (42);
\draw[->,green](42) -- (43);
\end{tikzpicture}
\end{document}