我想要绘制这个图:
我有以下 MWE(不完整):
\sf
\begin{tikzpicture}[node distance=2cm, on grid]
\tikzset{
mynode/.style={circle, draw,minimum width=8mm,inner sep=0pt},
myarrow/.style={-{Stealth[scale=1.5]}}
}
\node (1) {};
\node [mynode,right=of 1] (A1) {S};
\node [mynode,right=of A1] (B1) {I};
\draw [myarrow, right=of 1] (1)--(A1) node[midway,above] {$\mu$};
\draw [myarrow] (A1) -- (B1) node[midway,above] {$\beta$};
\end{tikzpicture}
答案1
如果你想让箭头从任何地方开始或结束,则不需要节点或坐标。例如,
\draw[<-] (A) -- ++(-1,0);
将从 左侧开始绘制一个箭头(A)
,指向(A)
。同样,
\draw[->] (A) -- ++(0,-1);
绘制一个从 开始(A)
并指向下方的箭头。
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\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};
\node [mynode,right=of B1] (C1) {R};
\draw [<-] (A1) -- ++(-1,0) node[left] {$\mu$};
\draw [->] (A1) -- node[above] {$\beta$} (B1);
\draw [->] (B1) -- node[above] {$\gamma$} (C1);
\draw [->] (A1) -- ++(0,-1) node[below] {$\nu$S};
\draw [->] (B1) -- ++(0,-1) node[below] {$\nu$I};
\draw [->] (C1) -- ++(0,-1) node[below] {$\nu$R};
\draw [->] (C1) to[out=135,in=45] node[above] {$\epsilon$} (A1);
\end{tikzpicture}
\end{document}