LaTeX approaches for five common paper figure types—algorithm flowcharts, experiment charts, network topology, system architecture, and data pipelines—with DrawFig from description to code.
shapes.geometric library provides diamonds (decisions), rounded rectangles (start/stop), and parallelograms (I/O).
\usetikzlibrary{shapes.geometric, arrows.meta, positioning}
\begin{tikzpicture}[
startstop/.style={rectangle, rounded corners, minimum width=2.5cm, minimum height=0.8cm, text centered, draw},
process/.style={rectangle, minimum width=2.5cm, minimum height=0.8cm, text centered, draw},
decision/.style={diamond, minimum width=2cm, minimum height=0.8cm, text centered, draw, aspect=2},
arrow/.style={thick, ->, >=Stealth}
]
\node (start) [startstop] {Start};
\node (init) [process, below=of start] {Init parameters};
\node (check) [decision, below=of init] {Condition met?};
\node (update) [process, below=of check] {Update state};
\node (stop) [startstop, below=of update] {Stop};
\draw[arrow] (start) -- (init);
\draw[arrow] (init) -- (check);
\draw[arrow] (check) -- node[right] {Yes} (update);
\draw[arrow] (check.west) -- ++(-1.5,0) |- node[above, near start] {No} (init.west);
\draw[arrow] (update) -- (stop);
\end{tikzpicture}
Define each shape once with style, then reference it on nodes—cleaner and easier to maintain.
pgfplots, a TikZ-based data-visualisation package:
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{tikzpicture}
\begin{axis}[
ybar,
bar width=12pt,
xlabel={Dataset},
ylabel={Accuracy (\%)},
symbolic x coords={Cora, Citeseer, Pubmed, ogbn-arxiv},
xtick=data,
legend style={at={(0.5,-0.2)}, anchor=north, legend columns=-1},
ymin=60, ymax=100,
nodes near coords,
nodes near coords align={vertical},
]
\addplot coordinates {(Cora,92.3) (Citeseer,88.7) (Pubmed,90.1) (ogbn-arxiv,85.4)};
\addplot coordinates {(Cora,85.1) (Citeseer,82.3) (Pubmed,84.6) (ogbn-arxiv,79.2)};
\legend{Ours, Baseline}
\end{axis}
\end{tikzpicture}
ybar gives vertical bars; symbolic x coords uses string x-labels; nodes near coords prints values on bars—reviewers appreciate explicit numbers.
graphdrawing can auto-layout (LuaLaTeX). Without switching compilers, manual coordinates are the safest bet:
\begin{tikzpicture}[
vertex/.style={circle, draw, minimum size=0.7cm, inner sep=0pt, font=\small},
edge/.style={thick},
node distance=2cm
]
\node[vertex, fill=blue!20] (v1) at (0,2) {$v_1$};
\node[vertex, fill=blue!20] (v2) at (2,2) {$v_2$};
\node[vertex, fill=red!20] (v3) at (1,0.5) {$v_3$};
\node[vertex] (v4) at (-1,0) {$v_4$};
\node[vertex] (v5) at (3,0) {$v_5$};
\draw[edge] (v1) -- (v2);
\draw[edge] (v2) -- (v3);
\draw[edge] (v1) -- (v4);
\draw[edge] (v3) -- (v5);
\draw[edge, dashed] (v4) -- (v5);
\draw[edge, bend left=25] (v1) to (v3);
\end{tikzpicture}
fill=blue!20 / fill=red!20 colour node groups; dashed marks weak ties; bend left=25 avoids overlapping straight edges.
fit and backgrounds draw grouped boxes:
\usetikzlibrary{fit, backgrounds, positioning}
\begin{tikzpicture}[
module/.style={rectangle, draw, rounded corners, minimum width=2.2cm, minimum height=0.8cm, text centered, fill=white},
arrow/.style={->, >=Stealth, thick}
]
\node[module, fill=green!15] (ui) {Frontend};
\node[module, fill=yellow!15, below=of ui] (api) {API gateway};
\node[module, fill=blue!15, below left=1cm and 0.5cm of api] (auth) {Auth service};
\node[module, fill=blue!15, below right=1cm and 0.5cm of api] (biz) {Business logic};
\node[module, fill=orange!15, below=1.5cm of api] (db) {Database};
\draw[arrow] (ui) -- (api);
\draw[arrow] (api) -- (auth);
\draw[arrow] (api) -- (biz);
\draw[arrow] (auth) -- (db);
\draw[arrow] (biz) -- (db);
\begin{scope}[on background layer]
\node[fit=(auth)(biz), draw, dashed, rounded corners, fill=gray!5, inner sep=10pt, label=above:Microservices] {};
\end{scope}
\end{tikzpicture}
fit computes bounding boxes; backgrounds keeps group frames behind foreground content.
chains strings steps quickly:
\usetikzlibrary{chains, arrows.meta}
\begin{tikzpicture}[
box/.style={rectangle, draw, rounded corners, minimum width=1.8cm, minimum height=0.7cm, text centered, fill=#1},
box/.default={white},
arrow/.style={->, >=Stealth, thick}
]
\node[box=green!15] (raw) {Raw data};
\node[box=yellow!15, right=1cm of raw] (clean) {Cleaning};
\node[box=orange!15, right=1cm of clean](feat) {Features};
\node[box=blue!15, right=1cm of feat] (train) {Training};
\node[box=red!15, right=1cm of train](eval) {Evaluation};
\draw[arrow] (raw) -- (clean);
\draw[arrow] (clean) -- (feat);
\draw[arrow] (feat) -- (train);
\draw[arrow] (train) -- (eval);
\end{tikzpicture}
Each stage gets a distinct colour; arrows show data flow with high information density and low reading cost.
\begin{figure}...\end{figure} and compile.