我该如何绘制下面的图表?
请您将其放在$\epsilon$
左边而不是右边。
我能做的最好的事情是:
\begin{tikzpicture}[node distance=2cm, on grid]
\tikzset{
mynode/.style = {circle,draw,minimum width=8mm,inner sep=0pt},
> = {Stealth[scale=1.5]}
}
\node [mynode] (A1) {S};
\node [mynode,right=of A1] (B1) {I_1};
\node [mynode,right=of B1] (C1) {I_2};
\node [mynode,right=of C1] (D1) {J};
\draw [<-] (A1) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A1) -- node[above] {$\beta$} (B1);
\draw [->] (B1) -- node[above] {$\sigma$} (C1);
\draw [->] (C1) -- node[above] {$\gamma$} (D1);
\draw [->] (A1) -- ++(0,-1) node[below] {$\nu$};
\draw [->] (B1) -- ++(0,-1) node[below] {$\nu$};
\draw [->] (C1) -- ++(0,-1) node[below] {$\nu$};
\draw [->] (D1) -- ++(0,-1) node[below] {$\nu$};
\draw [->] (D1) to[out=135,in=45] node[above] {$\xi$} (A1);
\end{tikzpicture}
这就是我所寻找的:
\documentclass[border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 11mm and 33mm,
N/.style = {draw, minimum size=12mm, inner sep=0pt},
> = {Stealth[scale=0.8]},
every edge/.append style = {draw, ->},
every edge quotes/.append style = {font=\small\linespread{0.63}\selectfont,
inner sep=5pt, sloped}
]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E) {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\nu S$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\nu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\nu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\nu J$};
\draw [->] ([xshift=-3.5mm] E.south) -- ++(0,-0.4) node[below] {$\nu \alpha$};
\draw [->] ([xshift=+3.5mm] E.south) -- ++(0,-0.4) node[below] {$\nu A$};
%
\draw ([yshift=+1mm] A.east)
edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
"$\begin{gathered}
p\beta_1 I_1\\
q\beta_2 JS\\
r\beta_3 AS
\end{gathered}$"] (B.west)
([yshift=-1mm] A.east)
edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
"$\begin{gathered}
(1-p)\beta_2 I_1\\
(1-q)\beta_2 JS\\
(1-r)\beta_3 AS
\end{gathered}$" '] (C.west)
(B) edge ["$\epsilon I_1$"] (C)
(D.west) edge ["$\xi_1 J$" ] ( B.east)
( C.east) edge ["$p_1 I_2$" ] (D.west)
([yshift=-2mm] D.west) edge ["$\xi_2 J$" '] ([yshift=-2mm] C.east)
(D) edge ["$p_2 J$"] (E);
\end{tikzpicture}
\end{document}
我如何翻转它$\epsilon I_1$
以便从左到右读取而不是从侧面读取?
答案1
嗯,你的 MWE 和你想要的不太接近。所以,既然你是网站新手,也是 LaTeX/Ti 新手钾Z,以下 MWE 可以作为所需解决方案的起点:
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 11mm and 22mm,
N/.style = {draw, minimum size=12mm, inner sep=0pt},
> = {Stealth[scale=0.8]},
every edge/.append style = {draw, ->, inner sep=5pt, sloped}
]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E) {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\mu_s$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\mu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\mu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\mu I$};
\draw [->] ([xshift=-3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
\draw [->] ([xshift=+3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
%
\draw ([yshift=+1mm] A.east)
edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
"${x,y,z}$" sloped] (B.west)
([yshift=-1mm] A.east)
edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
"${x',y',z'}$" sloped] (C.west)
(B) edge ["$\sigma$"] (C)
(B.east) edge ["$???$" ] ([yshift=+1mm] D.west)
( C.east) edge ["$???$" ] (D.west)
([yshift=-2mm] D.west) edge ["$???$" '] ([yshift=-2mm] C.east)
(D) edge ["$???$"] (E);
\end{tikzpicture}
\end{document}
附录
仍作为起点...我仍然不知道,您的边缘标签是什么。无论如何,从您的评论中,我猜从节点到S
节点如下图所示:I_1
I_2
为此,我在第一个 MWE 中做了以下更改:
- 加载包
amsmath
- 增加节点之间的距离
gathered
非常长的标签通过使用环境在三行中书写
\documentclass[border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 11mm and 33mm,
N/.style = {draw, minimum size=12mm, inner sep=0pt},
> = {Stealth[scale=0.8]},
every edge/.append style = {draw, ->},
every edge quotes/.append style = {font=\small\linespread{0.63}\selectfont,
inner sep=5pt, sloped}
]
\node [N] (A) {$S$};
\node [N,above right=of A] (B) {$I_1$};
\node [N,below right=of A] (C) {$I_2$};
\node [N,above right=of C] (D) {$J$};
\node [N,right=of D] (E) {$A$};
%
\draw [<-] (A) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A) -- ++(0,-1) node[below] {$\mu_s$};
\draw [->] ([xshift=3mm] B.south) -- ++(0,-0.4) node[below] {$\mu I_1$};
\draw [->] (C) -- ++(0,-1) node[below] {$\mu I_2$};
\draw [->] (D) -- ++(0,-1) node[below] {$\mu I$};
\draw [->] ([xshift=-3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
\draw [->] ([xshift=+3mm] E.south) -- ++(0,-0.4) node[below] {$\mu I$};
%
\draw ([yshift=+1mm] A.east)
edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
"$\begin{gathered}
p\beta_1 I_1\\
q\beta_2 JS\\
r\beta_3 AS
\end{gathered}$"] (B.west)
([yshift=-1mm] A.east)
edge [ultra thick, draw=gray,"\slash\slash\slash" anchor=center,
"$\begin{gathered}
(1-p)\beta_2 I_1\\
(1-q)\beta_2 JS\\
(1-r)\beta_3 AS
\end{gathered}$" '] (C.west)
(B) edge ["$\sigma$"] (C)
(B.east) edge ["$???$" ] ([yshift=+1mm] D.west)
( C.east) edge ["$???$" ] (D.west)
([yshift=-2mm] D.west) edge ["$???$" '] ([yshift=-2mm] C.east)
(D) edge ["$???$"] (E);
\end{tikzpicture}
\end{document}
S
如果您更喜欢节点和之间的三条线 I_1
,I_2
请考虑其他答案。
答案2
既然你提供了一些可以参考的东西,让我给你一个初步的思路。我没有完成这幅画,因为我只想提供一些想法,而且你的扫描图的某些部分确实很难读懂。
\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
\begin{tikzpicture}[node distance=2.5cm, on grid]
\tikzset{
font=\footnotesize,
> = {Stealth[scale=1.5]},
mynode/.style = {rectangle, draw, minimum width=8mm, minimum height=8mm, inner sep=0pt, font=\normalsize},
label/.style = {circle, fill=white, inner sep=0.25pt},
}
\node [mynode] (A1) {S};
\node [mynode, above right=of A1] (B1) {$I_1$};
\node [mynode, below right=of A1] (C1) {$I_2$};
\node [mynode, above right=of C1] (D1) {$J$};
\node [mynode, right=of D1] (E1) {$A$};
\draw [<-] (A1) -- ++(-1,0) node[left] {$J$};
\draw [->] (A1) -- node[right] {$z$} (B1);
\draw [->] ([xshift=-2.5mm]A1.north east) -- node[label] {$y$} ([yshift=2.5mm]B1.south west);
\draw [->] ([xshift=-5mm]A1.north east) -- node[left] {$x$} ([yshift=5mm]B1.south west);
\draw [->] ([xshift=-1.5mm]B1.south) -- node[left] {$\epsilon$} ([xshift=-1.5mm]C1.north);
\draw [->] ([xshift=1.5mm]B1.south) -- ++(0,-.5) node[below] {$\mu_{I_1}$};
\draw [->] (A1) -- ++(0,-1) node[below] {$\mu_S$};
% ...
\end{tikzpicture}
\end{document}
您可能应该熟悉允许您将节点从其当前位置移开的选项yshift
和。此外,您可能应该了解锚点。每个节点都带有一组锚点,例如,它将是节点的右上角。您可以通过在节点名称后附加一个点来引用这些锚点。xshift
north east