我正在使用数据库,想创建一个流程图,显示应用每个过滤条件时丢失了多少案例。简而言之,我想生成如下所示的“老式”流程图。这关联展示了如何使用 创建彩色图片\usepackage{smartdiagram}
,但我想创建一个非常简单、直截了当的图表。是否有现成的软件包,还是必须使用 来构建\usepackage{tikz}
?
答案1
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}%
[data/.style=
{draw,minimum height=0.7cm,minimum width=2cm,align=center},
filter/.style=
{draw,minimum height=1.3cm,minimum width=3cm,align=center},
database/.style=
{draw,minimum height=1.5cm,minimum width=3cm,align=center},
flow/.style={thick,-stealth},
apply/.style={}
]
\node[database] (db) {Database\\1995--2015};
\node[data,below=of db] (d1) {$N=4\,199$};
\node[data,below=of d1] (d2) {$N=2\,848$};
\node[data,below=of d2] (d3) {$N=2\,561$};
\draw[flow] (db) -- (d1);
\draw[flow] (d1) -- coordinate(d1d2) (d2);
\draw[flow] (d2) -- coordinate(d2d3) (d3);
\node[filter,right=of db] (excl) {Exclusions};
\node[filter] (f1) at (d1d2-|excl) {Males\\($N=250$)};
\draw[apply] (d1d2) -- (f1);
\node[filter] (f2) at (d2d3-|excl) {Not Obese\\($N=250$)};
\draw[apply] (d2d3) -- (f2);
\end{tikzpicture}
\end{document}