\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning, shapes.geometric, calc}
\title{TikZ Examples \& Diagrams}
\author{Bibby AI}
\date{\today}
\begin{document}
\maketitle
\section{Flowchart}
\begin{center}
\begin{tikzpicture}[
node distance=1.5cm,
startstop/.style={rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=red!30},
process/.style={rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30},
decision/.style={diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30},
arrow/.style={thick,->,>=stealth}
]
\node (start) [startstop] {Start};
\node (pro1) [process, below of=start] {Write LaTeX};
\node (dec1) [decision, below of=pro1, yshift=-0.5cm] {Compiles?};
\node (pro2a) [process, below of=dec1, yshift=-0.5cm] {Generate PDF};
\node (pro2b) [process, right of=dec1, xshift=3cm] {Fix Errors};
\node (stop) [startstop, below of=pro2a] {End};
\draw [arrow] (start) -- (pro1);
\draw [arrow] (pro1) -- (dec1);
\draw [arrow] (dec1) -- node[anchor=east] {Yes} (pro2a);
\draw [arrow] (dec1) -- node[anchor=south] {No} (pro2b);
\draw [arrow] (pro2b) |- (pro1);
\draw [arrow] (pro2a) -- (stop);
\end{tikzpicture}
\end{center}
\section{Neural Network}
\begin{center}
\begin{tikzpicture}[
neuron/.style={circle, draw, minimum size=1cm},
arrow/.style={->, >=stealth, thick}
]
\foreach \i in {1,...,3}
\node[neuron, fill=blue!20] (I\i) at (0, -\i*1.5) {$x_\i$};
\foreach \j in {1,...,4}
\node[neuron, fill=green!20] (H\j) at (3, -\j*1.2+0.3) {$h_\j$};
\foreach \k in {1,...,2}
\node[neuron, fill=red!20] (O\k) at (6, -\k*1.5-0.25) {$y_\k$};
\foreach \i in {1,...,3}
\foreach \j in {1,...,4}
\draw[arrow, gray!60] (I\i) -- (H\j);
\foreach \j in {1,...,4}
\foreach \k in {1,...,2}
\draw[arrow, gray!60] (H\j) -- (O\k);
\node[above=0.5cm] at (0, -0.5) {\textbf{Input}};
\node[above=0.5cm] at (3, -0.5) {\textbf{Hidden}};
\node[above=0.5cm] at (6, -0.5) {\textbf{Output}};
\end{tikzpicture}
\end{center}
\section{Tree Structure}
\begin{center}
\begin{tikzpicture}[
level 1/.style={sibling distance=4cm, level distance=1.5cm},
level 2/.style={sibling distance=2cm, level distance=1.5cm},
every node/.style={circle, draw, minimum size=0.8cm, fill=yellow!20}
]
\node {A}
child {node {B}
child {node {D}}
child {node {E}}
}
child {node {C}
child {node {F}}
child {node {G}}
};
\end{tikzpicture}
\end{center}
\section{Coordinate Plot}
\begin{center}
\begin{tikzpicture}
\draw[->] (-0.5,0) -- (5,0) node[right] {$x$};
\draw[->] (0,-0.5) -- (0,4) node[above] {$y$};
\draw[blue, thick, domain=0:4.5, samples=100] plot (\x, {0.15*\x*\x});
\draw[red, thick, domain=0:4.5, samples=100] plot (\x, {sqrt(\x)*1.5});
\node[blue] at (4, 3.5) {$y = 0.15x^2$};
\node[red] at (4, 2.2) {$y = 1.5\sqrt{x}$};
\foreach \x in {1,2,3,4}
\draw (\x, 0.1) -- (\x, -0.1) node[below] {\x};
\foreach \y in {1,2,3}
\draw (0.1, \y) -- (-0.1, \y) node[left] {\y};
\end{tikzpicture}
\end{center}
\end{document}

PDF Preview
Create an account to compile and preview