绘制这种图表的最简单方法是什么?

绘制这种图表的最简单方法是什么?

是否有任何预定义的形状来绘制这样的图表,还是我必须逐行绘制?提前致谢。在此处输入图片描述

答案1

编辑: 添加最新写作

\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}

\begin{document}

    \begin{tikzpicture}[thick]
        % Draw 1st order
        \draw (0,0) to node [pos=0.5, above] {100 C} ++ (4,0);

        % Draw 2nd order
        \foreach \j in {8.1,2.7,-2.7,-8.1}
        {
            \draw [-stealth] (4,0) --++ (1,\j) --++ (4,0);
        }
        \node [above right, align=left] at (6,8.1) {Text 1\\text 2};
        \node [above right, align=left] at (6,2.7) {Text 3\\text 4};
        \node [above right, align=left] at (6,-2.7) {Text 5\\text 6};
        \node [above right, align=left] at (6,-8.1) {Text 7\\text 8};

        % Draw 3rd and 4th orders
        \foreach \j in {8.1,2.7,-2.7,-8.1}
        {
            \draw (9,\j) --++ (4,0);
            \draw (9,\j+2.7) rectangle ++ (6,-5.4);
            \foreach \k in {2,1,-1,-2}
            {
                \draw [-stealth] (13,\j) --++ (1,\k) --++ (6,0);
            }
            % Fatest writing
            \node [right] at (20,\j+2) {Condensate};
            \node [right] at (20,\j+1) {NGL};
            \node [right] at (20,\j-1) {Sales Gas};
            \node [right] at (20,\j-2) {Sour Gas};
        }
        \node [above right] at (15,10.1) {Text 9};
        \node [above right] at (15,9.1) {Text 10};
    \end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

根据我在评论中提出的想法,这里是一个使用 pgf 数组和嵌套循环的实现。它需要 PGF 3.0.0,可以作为此新功能的一个稍微复杂的使用示例。

\documentclass[landscape,a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
% The following array defines the numbers and labels
% to appear at each final branch (at the right)
% Note the funny syntax with braces and quotes...
\def\myarray{{
{"foo/Condensate, 
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"},
{"foo/Condensate, 
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"},
{"foo/Condensate,
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"},
{"foo/Condensate, 
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"}
}}

% This is the style to format the numbers which appear
% above each branch
\tikzset{
   numbers/.style = {above right, font=\small, text width=4cm}
}

\begin{tikzpicture}[>=latex]
\draw (0,0) -- (3,0) node[above, midway] {100C,};

% Four main branches
\foreach [count=\i from 0] \label   in
  {{M-C-P\\some numbers}, 
   {Benzene\\more numbers},
   {CycC,\\even more numbers}, 
   {C,\\and final numbers}} {
  % Coordinate at which each one of main branches start
  \coordinate (aux) at ($(3,6)+(1,-4*\i)$);
  \draw[->] (3,0) -- (aux) node[numbers] {\label}
        -- +(4,0);
  % Rectangle at the end of each branch
  \draw (aux) ++(4,2) rectangle +(5,-4);
  \draw (aux) ++(4,0) -- +(3,0);

  % Inside the rectangle, four new branches
  \pgfmathsetmacro{\labels}{\myarray[\i]}
  \foreach [count=\j from 0] \n/\l in \labels {
    \draw[->] (aux) ++(7,0) -- ++(1,1.5-\j) 
        -- ++(1,0) node[numbers] {\n} -- ++(4,0)
       node[right] {\l};
  }
}
\end{tikzpicture}
\end{document}

结果:

结果

相关内容