LA

latex-drawing-guide

A guide for creating professional scientific figures within LaTeX documents using TikZ and PGFPlots.

Install

mkdir -p .claude/skills/latex-drawing-guide && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11482" && unzip -o skill.zip -d .claude/skills/latex-drawing-guide && rm skill.zip

Installs to .claude/skills/latex-drawing-guide

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

TikZ and PGFPlots techniques for publication-quality scientific figures
71 charsno explicit “when” trigger
Advanced

Key capabilities

  • Draw basic shapes like rectangles and circles in LaTeX.
  • Create node-based diagrams for scientific illustrations.
  • Generate neural network architectures, including fully connected layers and transformer blocks.
  • Visualize data with PGFPlots, creating line plots with error bars and bar charts.
  • Construct Bayesian network and graphical models.

How it works

This skill provides examples and techniques for creating publication-quality scientific figures directly within LaTeX using TikZ and PGFPlots. It covers basic shapes, node-based diagrams, neural network architectures, data visualizations, and graphical models.

Inputs & outputs

You give it
Description of a scientific figure, diagram, or data plot to be created in LaTeX.
You get back
LaTeX code using TikZ and PGFPlots to generate the requested figure.

When to use latex-drawing-guide

  • Draw neural network architectures
  • Create professional data plots
  • Design Bayesian network diagrams
  • Format LaTeX figures for publications

About this skill

LaTeX Drawing Guide

Overview

Publication-quality figures are a critical component of scientific papers. While external tools like matplotlib or Inkscape can produce good results, drawing figures directly in LaTeX using TikZ and PGFPlots offers unique advantages: figures share the same fonts and styling as the document, scale perfectly at any resolution, and remain fully version-controllable as plain text.

This guide draws from the awesome-latex-drawing repository (2,000+ stars), which provides 30+ complete examples of LaTeX-drawn figures covering Bayesian networks, neural network architectures, function plots, tensor diagrams, and machine learning frameworks. The techniques here apply broadly to any discipline that needs diagrams, flowcharts, or data plots embedded in LaTeX documents.

Learning TikZ has a steep initial curve, but the investment pays off substantially for researchers who publish frequently. Once you build a library of reusable components, creating new figures becomes fast and consistent.

TikZ Fundamentals

Basic Setup

\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning, calc, shapes.geometric, fit}

Coordinate System and Basic Shapes

\begin{tikzpicture}
  % Rectangle
  \draw[fill=blue!20, rounded corners] (0,0) rectangle (3,2);

  % Circle
  \draw[fill=red!20] (5,1) circle (1cm);

  % Arrow
  \draw[-{Stealth[length=3mm]}, thick] (3.2,1) -- (3.8,1);

  % Text node
  \node at (1.5,1) {Input};
  \node at (5,1) {Output};
\end{tikzpicture}

Node-Based Diagrams

Nodes are the building blocks of most scientific diagrams:

\begin{tikzpicture}[
  block/.style={
    rectangle, draw, fill=blue!10,
    minimum width=2.5cm, minimum height=1cm,
    rounded corners, font=\small
  },
  arrow/.style={-{Stealth[length=2.5mm]}, thick}
]
  \node[block] (input) {Data Input};
  \node[block, right=2cm of input] (process) {Processing};
  \node[block, right=2cm of process] (output) {Results};

  \draw[arrow] (input) -- (process);
  \draw[arrow] (process) -- (output);
\end{tikzpicture}

Neural Network Diagrams

Fully Connected Layer

\begin{tikzpicture}[
  neuron/.style={circle, draw, fill=orange!30, minimum size=8mm},
  conn/.style={->, gray!70}
]
  % Input layer
  \foreach \i in {1,...,3}
    \node[neuron] (I\i) at (0, -\i*1.2) {$x_{\i}$};

  % Hidden layer
  \foreach \j in {1,...,4}
    \node[neuron, fill=blue!20] (H\j) at (3, -\j*1.2+0.6) {$h_{\j}$};

  % Output layer
  \foreach \k in {1,...,2}
    \node[neuron, fill=green!20] (O\k) at (6, -\k*1.2-0.6) {$y_{\k}$};

  % Connections
  \foreach \i in {1,...,3}
    \foreach \j in {1,...,4}
      \draw[conn] (I\i) -- (H\j);
  \foreach \j in {1,...,4}
    \foreach \k in {1,...,2}
      \draw[conn] (H\j) -- (O\k);

  % Labels
  \node[above=0.3cm of I1] {\small Input};
  \node[above=0.3cm of H1] {\small Hidden};
  \node[above=0.3cm of O1] {\small Output};
\end{tikzpicture}

Transformer Block

\begin{tikzpicture}[
  block/.style={rectangle, draw, rounded corners, minimum width=3cm,
    minimum height=0.8cm, fill=#1, font=\small},
  block/.default=gray!10,
  arr/.style={-{Stealth}, thick}
]
  \node[block=yellow!20] (attn) at (0,0) {Multi-Head Attention};
  \node[block=blue!10] (norm1) at (0,1.3) {Add \& LayerNorm};
  \node[block=green!20] (ffn) at (0,2.6) {Feed-Forward Network};
  \node[block=blue!10] (norm2) at (0,3.9) {Add \& LayerNorm};

  \draw[arr] (attn) -- (norm1);
  \draw[arr] (norm1) -- (ffn);
  \draw[arr] (ffn) -- (norm2);

  % Residual connections
  \draw[arr, dashed, gray] (attn.west) -- ++(-0.8,0) |- (norm1.west);
  \draw[arr, dashed, gray] (ffn.west) -- ++(-0.8,0) |- (norm2.west);
\end{tikzpicture}

PGFPlots for Data Visualization

Setup

\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

Line Plot with Error Bars

\begin{tikzpicture}
\begin{axis}[
  width=0.8\textwidth,
  height=6cm,
  xlabel={Epoch},
  ylabel={Accuracy (\%)},
  legend pos=south east,
  grid=major,
  grid style={gray!30},
  tick label style={font=\small}
]
\addplot+[mark=o, thick, error bars/.cd, y dir=both, y explicit]
  coordinates {
    (1,72) +- (0,1.5)
    (5,85) +- (0,1.2)
    (10,91) +- (0,0.8)
    (20,94) +- (0,0.5)
    (50,96) +- (0,0.3)
  };
\addlegendentry{Our Method}

\addplot+[mark=square, thick, dashed]
  coordinates {(1,68) (5,79) (10,85) (20,89) (50,91)};
\addlegendentry{Baseline}
\end{axis}
\end{tikzpicture}

Bar Chart Comparing Methods

\begin{tikzpicture}
\begin{axis}[
  ybar,
  width=10cm, height=6cm,
  symbolic x coords={BLEU, ROUGE-L, METEOR},
  xtick=data,
  ylabel={Score},
  ymin=0, ymax=100,
  bar width=12pt,
  legend style={at={(0.5,1.05)}, anchor=south, legend columns=3},
  nodes near coords,
  nodes near coords style={font=\tiny}
]
\addplot coordinates {(BLEU,45.2) (ROUGE-L,62.1) (METEOR,38.7)};
\addplot coordinates {(BLEU,52.8) (ROUGE-L,68.4) (METEOR,44.3)};
\addplot coordinates {(BLEU,58.1) (ROUGE-L,71.9) (METEOR,49.6)};
\legend{Baseline, +Pretraining, +Fine-tuning}
\end{axis}
\end{tikzpicture}

Bayesian Network and Graphical Models

\begin{tikzpicture}[
  latent/.style={circle, draw, minimum size=1cm, fill=gray!20},
  observed/.style={circle, draw, minimum size=1cm, fill=white, thick},
  plate/.style={rectangle, draw, dashed, rounded corners, inner sep=10pt},
  arr/.style={-{Stealth}, thick}
]
  \node[latent] (theta) at (0,2) {$\theta$};
  \node[latent] (z) at (2,2) {$z_n$};
  \node[observed] (x) at (2,0) {$x_n$};
  \node[latent] (alpha) at (-1.5,2) {$\alpha$};

  \draw[arr] (alpha) -- (theta);
  \draw[arr] (theta) -- (z);
  \draw[arr] (z) -- (x);

  \node[plate, fit=(z)(x), label=below right:$N$] {};
\end{tikzpicture}

Best Practices

  • Define styles globally. Use \tikzset{} in the preamble so all figures share consistent colors and shapes.
  • Use relative positioning. right=2cm of nodeA is more maintainable than absolute coordinates.
  • Externalize figures. For large documents, use \usetikzlibrary{external} to cache compiled figures and speed up builds.
  • Match document fonts. TikZ inherits the document font automatically -- this is a key advantage over external tools.
  • Export standalone figures. Use the standalone document class to compile figures individually for reuse in presentations.
  • Keep source readable. One node or drawing command per line, with comments explaining the visual structure.

References

When not to use it

  • When external tools like matplotlib or Inkscape are preferred for figure creation.
  • When the user is not familiar with LaTeX or TikZ syntax.

Limitations

  • Learning TikZ has a steep initial curve.
  • The skill focuses on TikZ and PGFPlots, not other LaTeX drawing packages.
  • The skill does not cover all possible figure types or advanced customization options.

How it compares

This skill enables the creation of figures that share the same fonts and styling as the LaTeX document, scale perfectly, and are version-controllable as plain text, unlike figures generated by external tools.

Compared to similar skills

latex-drawing-guide side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
latex-drawing-guide (this skill)04moNo flagsAdvanced
draw-io416moReviewIntermediate
mermaid-expert274moNo flagsBeginner
excalidraw-diagram-generator182moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

draw-io

davila7

draw.io diagram creation, editing, and review. Use for .drawio XML editing, PNG conversion, layout adjustment, and AWS icon usage.

41204

mermaid-expert

sickn33

Create Mermaid diagrams for flowcharts, sequences, ERDs, and architectures. Masters syntax for all diagram types and styling. Use PROACTIVELY for visual documentation, system diagrams, or process flows.

27133

excalidraw-diagram-generator

github

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

1879

scientific-schematics

davila7

Create publication-quality scientific diagrams using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.

760

mermaid-diagrams

davila7

Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts, gantt charts, or any other diagram type. Triggers include requests to "diagram", "visualize", "model", "map out", "show the flow", or when explaining system architecture, database design, code structure, or user/application flows.

827

plantuml-ascii

github

Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or mentions plantuml ascii, text diagram, ascii art diagram. Supports: Converting PlantUML diagrams to ASCII art, Creating sequence diagrams, class diagrams, flowcharts in ASCII format, Generating Unicode-enhanced ASCII art with -utxt flag

826

Search skills

Search the agent skills registry