如何使用tikz latex绘制下图的示意图?

如何使用tikz latex绘制下图的示意图?

想用tikz latex画出下图的示意图,但是不正确。 在此处输入图片描述

\begin{tikzpicture}[node distance=4cm,auto,>=latex',every node/.append style={align=center},int/.style={draw, minimum size=1cm}]
\node [int] (P)             {Phytoplankton (P)};
\node [int, below=of P] (Z) {Zooplankton(Z)};
\node [int, right=of P] (M) {Macrophytes(M)};
\node [int, below=of M] (F) {Fish(F)};
\node [int, right=of F] (W) {Water hyacinth(W)};
\coordinate[right=of M] (out);
 \coordinate[right=of Z] (out);
  \coordinate[right=of F] (out);
  \coordinate[right=of W] (out);
\path[<->, auto=false] (P) edge node {Nutrient/sun light\\competition} (M)
   (M) edge node {competition\\Refuge     \\[2em] } (out) edge  [out=180, in=90] node[below] {competition and\\ Refuge} (W);

\结束{tikzpicture}

答案1

你已经走在正确的道路上了。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[node distance=5cm and 4cm,auto,>=latex,
every node/.append style={align=center},int/.style={draw, minimum size=1cm},
broken/.style={thick,blue,dashed}]
  \node [int] (P)             {Phytoplankton (P)};
  \node [int, below=of P] (Z) {Zooplankton (Z)};
  \node [int, right=of P] (M) {Macrophytes (M)};
  \node [int, below=of M] (F) {Fish (F)};
  \path (M) -- (F) node [pos=0.7,int,auto=false] (W) {Water hyacinth (W)};
  \draw[->] (Z) -- (F) node[midway] {Predation} %<- uses auto
  node[midway,above=1cm,dashed,draw] (R1) {Refuge effect}
  node[midway,below=1cm,dashed,draw] (R2) {Refuge effect};
  \draw[->] (P) -- (Z) node[midway,below=2mm,dashed,draw,sloped] (R3) {Refuge effect};
  \draw[->] (P) -- (F);
  \foreach \X/\Y in {P/90,M/90}
  {\draw[->] (\X.\Y) -- ++ (\Y:2) node[midway,swap,align=left]{Death\\ respiration};}
  \foreach \X/\Y in {Z/180,W/0,F/0}
  {\draw[->] (\X.\Y) -- ++ (\Y:2) node[midway,above,align=center]{Death\\ respiration};}
  \foreach \X/\Y in {P/M,P.south east/W.north west,M.south east/W.north}
  {\draw[<->,broken] (\X) -- (\Y) 
   node[midway,above,align=center,sloped] {Nutrient/sun\\ light competition};}
  \draw[broken,->]  (W) -- (R3);
  \draw[broken,->]  (W) -- (R1);
  \draw[broken,->]  (M) -- ++ (4.5,0) |- (R2);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容