答案1
使用正确的库和一些有用的键和样式,可以使用普通的 TikZ 来完成此操作。
cd
仅当起始和目标锚点固定时,shift left
和键shift right
才适用于库,但对于其他情况,我的包的库中的和的组合就足够了。graphs
nudge right
to path
ext.paths.ortho
tikz-ext
对于节点放置,chains
使用该库。
由于左列中的所有节点都是左对齐的,因此west below
放置策略(由提供ext.positioning-plus
)就足够了。
对于中间列,我将定义放置键mwb
(下面的中间西部)以及将新节点放置在与链中第一个节点meb
左对齐或右对齐的位置。middle-begin
middle
对于middle-6
(“发送给朋友...”)这将不再起作用,但我们可以nudge right
再次使用。
该键使用的值/tikz/diff text width
也用于box level
减少节点的宽度。
代码
\documentclass[tikz]{standalone}
\usetikzlibrary{
arrows.meta, cd, chains,
ext.positioning-plus,
ext.paths.ortho,
graphs, quotes}
\begin{document}
\begin{tikzpicture}[
>={Straight Barb[scale=2, angle'=45, round]},
box/.style={
shape=rectangle, align=flush center,
fill=blue!50, draw, rounded corners},
base text width/.initial=.5\linewidth,
diff text width/.initial=10mm,
box level/.style={
text width=\pgfkeysvalueof{/tikz/base text width}
-#1*\pgfkeysvalueof{/tikz/diff text width}},
every on chain/.style=box,
%%%
graphs/shift left/.style={
/tikz/commutative diagrams/shift left={
.5*(#1)*\pgfkeysvalueof{/tikz/diff text width}}},
graphs/shift left/.default=1,
graphs/shift right/.style={/tikz/graphs/shift left={-(#1)}},
graphs/shift right/.default=1,
nudge right/.style={xshift=#1*\pgfkeysvalueof{/tikz/diff text width}},
nudge right/.default=1,
]
\begin{scope}[start chain=left going west below]
\node[on chain, box level = 0] {
\textbf{Step 1: Design Your Project}\\
Are you an expert on all of the topics you will be studying/methods
you will be using, and do you have time to do the project by yourself?};
\node[on chain, box level = 1] {
Contact other scientist and ask them to collaborate.};
\node[on chain, box level = 0] {
Are you/your coauthors confident that you know
how to design your experiment and statistics properly?};
\node[on chain, box level = 1] {Contact a statistican for advice.};
\node[on chain, box level = 0] {\bfseries Step 2: Conduct Your Research};
\end{scope}
\begin{scope}[
start chain=middle going mwb,
mwb/.style args={of #1}{west below=of (middle-begin)(#1)},
meb/.style args={of #1}{east below=of (middle-begin)(#1)},
]
\node[on chain, box level = 0, north right=of left-begin] {
\textbf{Step 4: Write Your Paper}\\ Have your coauthors read it?};
\node[on chain, box level = 2] {
Send it to your coauthors.};
\node[on chain = going meb, box level = 1] {
Did your coauthors approve the paper in its present form?};
\node[on chain, box level = 2] {
Make the suggested revisions.};
\node[on chain = going meb, box level = 2] {
Are you confident that your paper is ready for publication?};
\node[on chain, nudge right, box level = 3] {
Send it to a friend/fellow scientist. Did they approve it?};
\node[on chain = going meb, box level = 1] {
\bfseries Step 5: Submit Your Paper to a Suitable Journal.};
\end{scope}
\graph[
use existing nodes, /tikz/ortho/install shortcuts,
edge quotes={auto=false, fill=white, inner sep=+.2em},
east down/.style={left anchor=south east, right anchor=north east},
west up/.style ={left anchor=north west, right anchor=south west},
west down/.style={left anchor=south west, right anchor=north west},
No/.style={*|, "No"}, Yes/.style={east down, shift right, "Yes"},
/tikz/c/.style={shape=coordinate, name={#1}},
]{
(left-1) ->[No] (left-2)
->[|*] (left-3),
(left-1) ->[Yes] (left-3)
->[No] (left-4)
->[|*] (left-5),
(left-3) ->[Yes] (left-5)
->[-|-] (middle-1)
->[No] (middle-2)
->[|*] (middle-3),
(middle-1) ->[east down, shift right, "Yes"] (middle-3)
->[No] (middle-4)
->[west up, shift right] (middle-2),
(middle-3) ->[Yes] (middle-5),
(middle-5) ->[west down, nudge right=.5, |*, "No"] (middle-6)
->[west up, nudge right=.5, |*, "No"] (middle-4),
(middle-5) ->[Yes, near start, "" c=m57] (middle-7),
(middle-6) ->["Yes", -*] m57,
};
\end{tikzpicture}
\end{document}