无法用项目列表绘制良好流程图

无法用项目列表绘制良好流程图

我需要绘制一个流程图,其中项目以项目符号表示。我尝试使用以下方法进行绘制:

\begin{tikzpicture}[node distance = 4cm, auto]
    % Place nodes

      \node  [block] (init)
      {
      {dataset 
      \begin{itemize}
       \item Boundary dataset
       \item Emission dataset
      \end{itemize}}
      }

    \node [block, below of=init] (identify) {Run Model  WRF-Chem};
    \node [block, below of=identify] (evaluate) {Model Result \item PM and ozone \item fire and nofire values};
    \node [block, below of=evaluate] (evaluation) {Result Validation \item OM and ozone from instrument  \item For AOD modis datas};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (evaluation);

\end{tikzpicture}

我也尝试过:

\begin{center}
\begin{tikzpicture}[node distance = 4cm, auto]
\begin{itemize}

    % Place nodes
    \node [block] (init) {Data collection \item Boundary dataset  \item Emission dataset};
    \node [block, below of=init] (identify) {Run Model \item WRF-Chem};
    \node [block, below of=identify] (evaluate) {Model Result \item PM and ozone \item fire and nofire values};
    \node [block, below of=evaluate] (evaluation) {Result Validation \item OM and ozone from instrument  \item For AOD modis datas};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (evaluation);

\end{itemize}
\end{tikzpicture}

但结果却是这样的:

在此处输入图片描述

我该如何组织项目符号以便它们到达准确的位置?

答案1

你的例子不完整,我发明了block和的定义line

你忘了\begin{itemize} ... \end{itemize}两个节点。

经过这两次修正后,它就可以完美运行了。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\tikzset{
    block/.style={
        draw, 
        rounded corners,
        text width=12em,
        text centered,
        minimum height=20ex,
        fill=cyan!70!white
    },
    line/.style={
        draw, 
        -Stealth
    },
}
\begin{document}
\begin{tikzpicture}[node distance = 4cm, auto]
    % Place nodes
      \node  [block] (init)
      {
      {dataset 
      \begin{itemize}
       \item Boundary dataset
       \item Emission dataset
      \end{itemize}}
      };
    \node [block, below of=init] (identify) {Run Model  WRF-Chem};
    \node [block, below of=identify] (evaluate) {Model Result \begin{itemize}
    \item PM and ozone 
    \item fire and nofire values
    \end{itemize}};
    \node [block, below of=evaluate] (evaluation) {Result Validation \begin{itemize}
    \item OM and ozone from instrument  
    \item For AOD modis datas
    \end{itemize}};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (evaluation);
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

大部分都是题外话,因为你的问题的原因已经在 车牌回答。

通过使用tikzarrows.meta(用于箭头),chains(用于链中的链接节点并使用其宏join) and定位(to determine distance between nodes) , and the packageenumitem 连接它们)(用于节点中的列表),您可以按照以下方式重新设计您的流程图:

在此处输入图片描述

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, chains, positioning}
\usepackage{enumitem}

\begin{document}
    \begin{tikzpicture}[
node distance = 3ex,
  start chain = going below,
every node/.style = {draw, rounded corners, fill=blue!20,
                     text width=11em, minimum height=12ex,
                     align=center,
                     on chain, join=by -Stealth}
                        ]
\setlist[itemize,1]{nosep,
                    leftmargin=*}
%
\node   {dataset
        \begin{itemize}
   \item Boundary dataset
   \item Emission dataset
    \end{itemize}};
\node   {Run Model  WRF-Chem};
\node   {Model Result
        \begin{itemize}
   \item PM and ozone
   \item fire and nofire values
        \end{itemize}};
\node   {Result Validation
        \begin{itemize}
   \item OM and ozone from instrument
   \item For AOD modis datas
        \end{itemize}};
\end{tikzpicture}
\end{document}

相关内容