LabCanvas

TikZ examples: 179 figures with code, by field

Quick answer

Here are 179 TikZ figures with their complete code, in 11 fields: physics, chemistry, biology, machine learning, mathematics, electronics and signals, computer science, plots and charts, diagrams, commutative diagrams, and colour and shading. They come from open-source collections whose licences allow any use (MIT or CC0), and each figure keeps its author, source and licence. Open any of them in the TikZ editor to change it, or copy its code into your own document.

Contents

Browse by field

Each field has its own page with all of its figures, grouped by topic:

A few figures from each field

“Open in the TikZ editor” loads the figure’s whole document, with its source and licence, into the free TikZ editor, where it is typeset with TeX Live 2026 as you change it. The licence link goes to the licence’s full text; the repository link goes to the original file.

Physics (18)

All 18 physics examples

Chemistry (6)

All 6 chemistry examples

Biology (5)

All 5 biology examples

Machine learning (56)

All 56 machine learning examples

Mathematics (36)

All 36 mathematics examples

Electronics & signals (7)

All 7 electronics & signals examples

Computer science (12)

All 12 computer science examples

Plots & charts (16)

All 16 plots & charts examples

Diagrams (14)

All 14 diagrams examples

Commutative diagrams (3)

Commutative diagrams examples page

Colour & shading (6)

All 6 colour & shading examples

Where the figures come from

The figures were collected from these open-source repositories, at fixed commits, and kept only if they compile on their own, within ten seconds, in the TeX Live 2026 setup the TikZ editor uses. Collections, figures and files that carried no licence, a share-alike licence, or that were adapted from other people’s work were left out.

CollectionCopyright holderLicenceFigures
MartinThoma/LaTeX-examplesMartin ThomaMIT licence40
PetarV-/TikZPetar VeličkovićMIT licence38
janosh/diagramsJanosh Riebesell and contributorsMIT licence35
PacktPublishing/LaTeX-graphics-with-TikZPackt (code from LaTeX Graphics with TikZ by Stefan Kottwitz)MIT licence29
xinychen/awesome-latex-drawingXinyu ChenMIT licence12
fraserlove/nntikzFraser LoveMIT licence11
opentikz/opentikzOpenTikZ contributorsCC0 1.08
bueler/tikz-examplesEd BuelerMIT licence3
andreas-bauer/tikzAndreas BauerMIT licence2
Devin-Taylor/TikZDevin TaylorMIT licence1

LabCanvas changed a file only where it had to compile on its own: the document class became standalone where needed, and the repository’s own helper files were copied in. The first lines of each figure’s code say where it comes from, who holds the copyright, which licence applies and what was changed.

  1. Open it in the TikZ editor (or open the source file from the repository link) and check that it compiles.
  2. Keep the first comment lines of the code. They name the source, the copyright holder and the licence; the MIT licence asks that its copyright and permission notice go with copies of the code.
  3. Change what you need: labels, colours, sizes. Most figures are a single tikzpicture in a standalone document.
  4. Use it in your document: either compile it on its own and include the PDF with \includegraphics, or move its \usepackage and \usetikzlibrary lines into your preamble and paste the tikzpicture where the figure goes.

Some figures were written for older versions of TikZ and load the arrows library, which the manual marks as deprecated in favour of arrows.meta. They still compile; in new code, prefer arrows.meta.

Frequently asked questions

Can I use these TikZ examples in my paper or thesis?

Yes. Every figure is under the MIT licence or CC0 1.0, both of which allow use, change and redistribution, commercial use included. For MIT figures, keep the copyright and permission notice with the code (the first lines of each file point to it), and credit the author in your caption as a courtesy.

Do I need to credit the author?

For CC0 figures, no. For MIT figures, the licence asks that its copyright and permission notice travel with copies of the code; keep the comment lines at the top of the file. Crediting the source in your figure caption is courteous either way.

Why does an example not compile in my document?

Most figures are standalone documents. When you paste only the tikzpicture into your own file, also copy its \usepackage and \usetikzlibrary lines (and any \pgfplotsset line) into your preamble. A figure marked LuaLaTeX must be compiled with LuaLaTeX.

Is there a search?

The TikZ editor’s library has a search box over the same figures (titles, topics and sources). Open the TikZ editor and choose Browse the library.

How were the thumbnails made?

Each thumbnail was rendered from the figure’s code with TeX Live, the same way the TikZ editor renders code.

References

  1. LabCanvas TikZ library: sources and licences (full licence texts)labcanvas.com
  2. The MIT License (Open Source Initiative)opensource.org
  3. CC0 1.0 Universal (Creative Commons)creativecommons.org
  4. PGF/TikZ manual (version 3.1.12), §16.1 Arrows: overview (the arrows library is deprecated)tikz.dev
  5. PGF/TikZ manual (version 3.1.12), §42 Arrow Tip Librarytikz.dev
  6. standalone class manual (v1.5a), §5.1 Basic usagemirrors.ctan.org

More TikZ guides

Tools

Try the code in your browserPaste any TikZ code into the free TikZ editor: it is typeset with TeX Live as you type, with errors pointed at their line.

Open the TikZ editor