WikiAdministration

Diagrams

History

Version 1 (current)

Saved by someone unknown

Read this version

The first version: all of its text is new.

1# Diagrams
2
3A `mermaid` fence is drawn by Mermaid, in the browser.
4
5```mermaid
6classDiagram
7 Space "1" --> "*" Page
8 Space "1" --> "*" Space : subspaces
9 Page "1" --> "*" Attachment
10```
11
12```mermaid
13pie title Where the time goes
14 "Writing" : 60
15 "Rewriting" : 30
16 "Naming things" : 10
17```
18
19A `tikz` fence is drawn by TikZ, which TeX runs in your browser. It holds the commands of a picture, or a whole `tikzpicture`, or a commutative diagram:
20
21```tikz
22\begin{tikzcd}
23 A \arrow[r, "f"] \arrow[d, "h"'] & B \arrow[d, "g"] \\
24 C \arrow[r, "k"'] & D
25\end{tikzcd}
26```
27
28A line at the top of the fence that loads a library, or a package, is read before the picture, as LaTeX wants it:
29
30```tikz
31\usetikzlibrary{positioning, arrows.meta}
32\begin{tikzpicture}[node distance=2cm, box/.style={draw, rounded corners}, >={Stealth[length=3mm]}]
33 \node[box] (md) {Markdown};
34 \node[box, right=of md] (html) {Halogen HTML};
35 \node[box, right=of html] (page) {the page};
36 \draw[->] (md) -- node[above] {parse} (html);
37 \draw[->] (html) -- node[above] {render} (page);
38\end{tikzpicture}
39```
40
41A plot, with pgfplots:
42
43```tikz
44\begin{tikzpicture}
45\begin{axis}[xlabel=$x$, ylabel={$\sin x$}, width=8cm, height=5cm]
46 \addplot[domain=0:360, samples=60, thick] {sin(x)};
47\end{axis}
48\end{tikzpicture}
49```

What a page can hold