如何創建此圖形?

如何創建此圖形?

我已经花了几个小时来创建这个图形 - 但没有成功。

我尝试了不同类型的 tikz、tikzpicture、pstricks 和 multido usepackage。你能帮我吗?我将不胜感激。 在此处输入图片描述

答案1

一种使用 TikZ 的选项;该fit库仅用于绘制外框;根据实际需求,可以在不使用库的情况下完成此操作(参见下面的第二个示例代码):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}

\begin{document}

\begin{tikzpicture}[
mytext/.style={
  draw,
  text width=#1,
  align=center,
  minimum height=1.5cm
  },
ar/.style={
  ->,
  >=latex
  }  
]
\node[mytext=3cm,minimum height=8cm] (left)
  {2 text text text};
\node[mytext=4cm,anchor=north west] 
  at ([xshift=1.5cm]left.north east) (middle1)
  {4 text text text};
\node[mytext=4cm,anchor=west] 
  at ([xshift=1.5cm]left.east) (middle2)
  {5 text text text};
\node[mytext=4cm,anchor=south west] 
  at ([xshift=1.5cm]left.south east) (middle3)
  {6 text text text};
\node[mytext=3cm,minimum height=8cm,anchor=north west] 
  at ([xshift=1.5cm]middle1.north east) (right)
  {8 text text text};
\coordinate (aux) at ([yshift=3cm]middle1);
\node[mytext=4cm,dashed,minimum height=0.8cm,anchor=north] 
  at (aux) (middle0)
  {3 text text};  
\node[mytext=3cm,dashed,anchor=north] 
  at (left.center|-aux) (left0)
  {1 text text};  
\node[mytext=3cm,dashed,anchor=north] 
  at (right.center|-aux) (right0)
  {7 text text};
\node[draw,inner sep=10pt,fit={(left0) (right)}] {};

\foreach \Valor in {1,2,3}
{
\draw[ar]
  (left.east|-middle\Valor.west) -- (middle\Valor.west);    
\draw[ar]
  (middle\Valor.east) -- (right.west|-middle\Valor.west);    
}
\end{tikzpicture}

\end{document}

在此处输入图片描述

不使用fit库(结果与上图相同):

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[
mytext/.style={
  draw,
  text width=#1,
  align=center,
  minimum height=1.5cm
  },
ar/.style={
  ->,
  >=latex
  }  
]
\node[mytext=3cm,minimum height=8cm] (left)
  {2 text text text};
\node[mytext=4cm,anchor=north west] 
  at ([xshift=1.5cm]left.north east) (middle1)
  {4 text text text};
\node[mytext=4cm,anchor=west] 
  at ([xshift=1.5cm]left.east) (middle2)
  {5 text text text};
\node[mytext=4cm,anchor=south west] 
  at ([xshift=1.5cm]left.south east) (middle3)
  {6 text text text};
\node[mytext=3cm,minimum height=8cm,anchor=north west] 
  at ([xshift=1.5cm]middle1.north east) (right)
  {8 text text text};
\coordinate (aux) at ([yshift=3cm]middle1);
\node[mytext=4cm,dashed,minimum height=0.8cm,anchor=north] 
  at (aux) (middle0)
  {3 text text};  
\node[mytext=3cm,dashed,anchor=north] 
  at (left.center|-aux) (left0)
  {1 text text};  
\node[mytext=3cm,dashed,anchor=north] 
  at (right.center|-aux) (right0)
  {7 text text};
\draw
  ([shift={(-10pt,10pt)}]left0.north west)
    rectangle
  ([shift={(10pt,-10pt)}]right.south east);

\foreach \Valor in {1,2,3}
{
\draw[ar]
  (left.east|-middle\Valor.west) -- (middle\Valor.west);    
\draw[ar]
  (middle\Valor.east) -- (right.west|-middle\Valor.west);    
}
\end{tikzpicture}

\end{document}

答案2

\documentclass{article}
\usepackage{pst-node,pst-blur}    
\begin{document}    
\newpsstyle{Dashed}{linestyle=dashed,shadow=false,blur=false,fillstyle=solid}

\begin{pspicture}[showgrid=false,arrowscale=2,shadow,blur,framearc=0.05](-1,-1)(14,11)
\psframe[blur=0,framearc=0,fillcolor=black!10,fillstyle=solid](-0.5,-0.5)(13.5,10.5)
\psTextFrame[style=Dashed](0,8.5)(3,10){1 text text}
\psTextFrame(0,0)(3,8){2 text text text}
%
\psTextFrame[style=Dashed](4.5,9)(8.5,10){3 text text text}
\psTextFrame(4.5,6.5)(8.5,8){4 text text text}
\psTextFrame(4.5,3.25)(8.5,4.75){5 text text text}
\psTextFrame(4.5,0)(8.5,1.5){6 text text text}
%
\psTextFrame[style=Dashed](10,8.5)(13,10){7 text text}
\psTextFrame(10,0)(13,8){8 text text text}
%
\psset{shadow=false}
\psline{->}(3,7.25)(4.5,7.25)\psline{->}(8.5,7.25)(10,7.25)
\psline{->}(3,4)(4.5,4)      \psline{->}(8.5,4)(10,4)
\psline{->}(3,0.75)(4.5,0.75)\psline{->}(8.5,0.75)(10,0.75)
\end{pspicture}

\end{document}

在此处输入图片描述

相关内容