diff --git a/tikz/lda-gauss-2/lda-gauss-2.png b/tikz/lda-gauss-2/lda-gauss-2.png index dedde58..d3dc311 100644 Binary files a/tikz/lda-gauss-2/lda-gauss-2.png and b/tikz/lda-gauss-2/lda-gauss-2.png differ diff --git a/tikz/lda-gauss-2/lda-gauss-2.tex b/tikz/lda-gauss-2/lda-gauss-2.tex index 298b07c..69cbace 100644 --- a/tikz/lda-gauss-2/lda-gauss-2.tex +++ b/tikz/lda-gauss-2/lda-gauss-2.tex @@ -13,11 +13,27 @@ } % to be used: \gauss(x)(mean)(variance) +\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother + \pgfplotsset{ tick label style = {font=\sansmath\sffamily}, every axis label/.append style={font=\sffamily\footnotesize}, } +\pgfplotsset{axis line on top/.style={ + axis line style=transparent, + ticklabel style=transparent, + tick style=transparent, + axis on top=false, + after end axis/.append code={ + \pgfplotsset{axis line style=opaque, + ticklabel style=opaque, + tick style=opaque, + grid=none} + \pgfplotsdrawaxis} + } +} + \begin{document} \begin{preview} \tikzstyle{plotA}=[ultra thick,red!90!black] @@ -28,7 +44,7 @@ every axis label/.append style={font=\sffamily\footnotesize}, height=8.625cm, % Grid grid = major, - %grid style={thin, dashed}, + grid style={thin, dashed}, % size xmin= 0, % start the diagram at this x-coordinate xmax= 125, % end the diagram at this x-coordinate @@ -53,6 +69,8 @@ every axis label/.append style={font=\sffamily\footnotesize}, % Axis axis lines = middle, axis line style = very thick, + axis line on top, + axis line style = {very thick,shorten <=-0.5\pgflinewidth}, xlabel=$x$, x label style={at={(axis description cs:0.52,0)}, anchor=north, diff --git a/tikz/lda-gauss-intervariance-big/Makefile b/tikz/lda-gauss-intervariance-big/Makefile new file mode 100644 index 0000000..e36180f --- /dev/null +++ b/tikz/lda-gauss-intervariance-big/Makefile @@ -0,0 +1,33 @@ +SOURCE = lda-gauss-intervariance-big +DELAY = 80 +DENSITY = 300 +WIDTH = 512 + +make: + pdflatex -shell-escape $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot + +gif: + pdfcrop $(SOURCE).pdf + convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif + make clean + +png: + make + make svg + inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png + +transparentGif: + convert $(SOURCE).pdf -transparent white result.gif + make clean + +svg: + #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg + pdf2svg $(SOURCE).pdf $(SOURCE)1.svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE)1.svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg + rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg + rm $(SOURCE)1.svg \ No newline at end of file diff --git a/tikz/lda-gauss-intervariance-big/README.md b/tikz/lda-gauss-intervariance-big/README.md new file mode 100644 index 0000000..fd2a8fc --- /dev/null +++ b/tikz/lda-gauss-intervariance-big/README.md @@ -0,0 +1,3 @@ +Compiled example +---------------- +![Example](lda-gauss-intervariance-big.png) \ No newline at end of file diff --git a/tikz/lda-gauss-intervariance-big/lda-gauss-intervariance-big.png b/tikz/lda-gauss-intervariance-big/lda-gauss-intervariance-big.png new file mode 100644 index 0000000..fdd4ec5 Binary files /dev/null and b/tikz/lda-gauss-intervariance-big/lda-gauss-intervariance-big.png differ diff --git a/tikz/lda-gauss-intervariance-big/lda-gauss-intervariance-big.tex b/tikz/lda-gauss-intervariance-big/lda-gauss-intervariance-big.tex new file mode 100644 index 0000000..3e62ba0 --- /dev/null +++ b/tikz/lda-gauss-intervariance-big/lda-gauss-intervariance-big.tex @@ -0,0 +1,104 @@ +\documentclass[varwidth=true, border=5pt]{article} +\usepackage[active,tightpage]{preview} +\usepackage[latin1]{inputenc} +\usepackage{amsmath} +\usepackage{pgfplots} +\usepackage{tikz} +\usetikzlibrary{arrows,positioning} +\usepackage{helvet} +\usepackage[eulergreek]{sansmath} + +\pgfmathdeclarefunction{gauss}{2}{% + \pgfmathparse{1/(sqrt(2*pi*#2))*exp(-((x-#1)^2)/(2*#2))}% +} +% to be used: \gauss(x)(mean)(variance) + +\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother + +\pgfplotsset{ +tick label style = {font=\sansmath\sffamily}, +every axis label/.append style={font=\sffamily\footnotesize}, +} + +\pgfplotsset{axis line on top/.style={ + axis line style=transparent, + ticklabel style=transparent, + tick style=transparent, + axis on top=false, + after end axis/.append code={ + \pgfplotsset{axis line style=opaque, + ticklabel style=opaque, + tick style=opaque, + grid=none} + \pgfplotsdrawaxis} + } +} + +\tikzset{>=latex} + +\begin{document} +\begin{preview} +\tikzstyle{plotA}=[ultra thick,red!90!black] +\tikzstyle{plotB}=[ultra thick,cyan!50!black] +\begin{tikzpicture} + \begin{axis}[ + width=13.5cm, + height=8.625cm, + % Grid + grid = major, + grid style={thin, dashed}, + % size + xmin= 20, % start the diagram at this x-coordinate + xmax= 105, % end the diagram at this x-coordinate + ymin= 0, % start the diagram at this y-coordinate + ymax= 0.07, % end the diagram at this y-coordinate + % Legende + legend style={ + font=\large\sansmath\sffamily, + at={(0.5,-0.18)}, + anchor=north, + legend cell align=left, + legend columns=-1, + column sep=0.5cm + }, + % Ticks + tick align=inside, + scaled y ticks = false, + %xtick={20,30,...,100}, + ytick=\empty, + % Axis + axis lines = middle, + axis line style = very thick, + axis line on top, + axis line style = {very thick,shorten <=-0.5\pgflinewidth}, + xlabel=$x$, + x label style={at={(axis description cs:0.52,0)}, + anchor=north, + font=\boldmath\Large}, + ylabel=$f(x)$, + y label style={at={(axis description cs:0,0.5)}, + anchor=south, + rotate=90, + font=\boldmath\Large}, + ] + + % Mark means + \coordinate (axisOrigin) at (axis cs:0,0); + \coordinate (meanA) at (axis cs:80,0.063); + \draw[black,thick](meanA |- axisOrigin) -- (meanA); + + \coordinate (meanB) at (axis cs:40,0.063); + \draw[black,thick](meanB |- axisOrigin) -- (meanB); + \draw[black,ultra thick,<->](axis cs:40,0.007) -- (axis cs:80,0.007); + + % Plots of the distributions + \addplot [domain=0:100,samples=400,plotA] {gauss(80,40)}; + \addplot [domain=0:100,samples=400,plotB] {gauss(40,40)}; + + % Add labels + \node[plotA,above] at (axis cs:63,0.055){\Large $\mathcal{N}(80, 40)$}; + \node[plotB,above] at (axis cs:28,0.055){\Large $\mathcal{N}(40, 40)$}; + \end{axis} +\end{tikzpicture} +\end{preview} +\end{document} diff --git a/tikz/lda-gauss-intervariance/Makefile b/tikz/lda-gauss-intervariance/Makefile new file mode 100644 index 0000000..b037388 --- /dev/null +++ b/tikz/lda-gauss-intervariance/Makefile @@ -0,0 +1,33 @@ +SOURCE = lda-gauss-intervariance +DELAY = 80 +DENSITY = 300 +WIDTH = 512 + +make: + pdflatex -shell-escape $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot + +gif: + pdfcrop $(SOURCE).pdf + convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif + make clean + +png: + make + make svg + inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png + +transparentGif: + convert $(SOURCE).pdf -transparent white result.gif + make clean + +svg: + #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg + pdf2svg $(SOURCE).pdf $(SOURCE)1.svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE)1.svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg + rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg + rm $(SOURCE)1.svg \ No newline at end of file diff --git a/tikz/lda-gauss-intervariance/README.md b/tikz/lda-gauss-intervariance/README.md new file mode 100644 index 0000000..8355beb --- /dev/null +++ b/tikz/lda-gauss-intervariance/README.md @@ -0,0 +1,3 @@ +Compiled example +---------------- +![Example](lda-gauss-intervariance.png) \ No newline at end of file diff --git a/tikz/lda-gauss-intervariance/lda-gauss-intervariance.png b/tikz/lda-gauss-intervariance/lda-gauss-intervariance.png new file mode 100644 index 0000000..724aab2 Binary files /dev/null and b/tikz/lda-gauss-intervariance/lda-gauss-intervariance.png differ diff --git a/tikz/lda-gauss-intervariance/lda-gauss-intervariance.tex b/tikz/lda-gauss-intervariance/lda-gauss-intervariance.tex new file mode 100644 index 0000000..f820ce9 --- /dev/null +++ b/tikz/lda-gauss-intervariance/lda-gauss-intervariance.tex @@ -0,0 +1,104 @@ +\documentclass[varwidth=true, border=5pt]{article} +\usepackage[active,tightpage]{preview} +\usepackage[latin1]{inputenc} +\usepackage{amsmath} +\usepackage{pgfplots} +\usepackage{tikz} +\usetikzlibrary{arrows,positioning} +\usepackage{helvet} +\usepackage[eulergreek]{sansmath} + +\pgfmathdeclarefunction{gauss}{2}{% + \pgfmathparse{1/(sqrt(2*pi*#2))*exp(-((x-#1)^2)/(2*#2))}% +} +% to be used: \gauss(x)(mean)(variance) + +\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother + +\pgfplotsset{ +tick label style = {font=\sansmath\sffamily}, +every axis label/.append style={font=\sffamily\footnotesize}, +} + +\pgfplotsset{axis line on top/.style={ + axis line style=transparent, + ticklabel style=transparent, + tick style=transparent, + axis on top=false, + after end axis/.append code={ + \pgfplotsset{axis line style=opaque, + ticklabel style=opaque, + tick style=opaque, + grid=none} + \pgfplotsdrawaxis} + } +} + +\tikzset{>=latex} + +\begin{document} +\begin{preview} +\tikzstyle{plotA}=[ultra thick,red!90!black] +\tikzstyle{plotB}=[ultra thick,cyan!50!black] +\begin{tikzpicture} + \begin{axis}[ + width=13.5cm, + height=8.625cm, + % Grid + grid = major, + grid style={thin, dashed}, + % size + xmin= 20, % start the diagram at this x-coordinate + xmax= 105, % end the diagram at this x-coordinate + ymin= 0, % start the diagram at this y-coordinate + ymax= 0.07, % end the diagram at this y-coordinate + % Legende + legend style={ + font=\large\sansmath\sffamily, + at={(0.5,-0.18)}, + anchor=north, + legend cell align=left, + legend columns=-1, + column sep=0.5cm + }, + % Ticks + tick align=inside, + scaled y ticks = false, + %xtick={20,30,...,100}, + ytick=\empty, + % Axis + axis lines = middle, + axis line style = very thick, + axis line on top, + axis line style = {very thick,shorten <=-0.5\pgflinewidth}, + xlabel=$x$, + x label style={at={(axis description cs:0.52,0)}, + anchor=north, + font=\boldmath\Large}, + ylabel=$f(x)$, + y label style={at={(axis description cs:0,0.5)}, + anchor=south, + rotate=90, + font=\boldmath\Large}, + ] + + % Mark means + \coordinate (axisOrigin) at (axis cs:0,0); + \coordinate (meanA) at (axis cs:50,0.063); + \draw[black,thick](meanA |- axisOrigin) -- (meanA); + + \coordinate (meanB) at (axis cs:40,0.063); + \draw[black,thick](meanB |- axisOrigin) -- (meanB); + \draw[black,ultra thick,<->](axis cs:40,0.007) -- (axis cs:50,0.007); + + % Plots of the distributions + \addplot [domain=0:100,samples=400,plotA] {gauss(50,40)}; + \addplot [domain=0:100,samples=400,plotB] {gauss(40,40)}; + + % Add labels + \node[plotA,above] at (axis cs:63,0.055){\Large $\mathcal{N}(50, 40)$}; + \node[plotB,above] at (axis cs:28,0.055){\Large $\mathcal{N}(40, 40)$}; + \end{axis} +\end{tikzpicture} +\end{preview} +\end{document} diff --git a/tikz/lda-gauss-variance-big/Makefile b/tikz/lda-gauss-variance-big/Makefile new file mode 100644 index 0000000..cd05e84 --- /dev/null +++ b/tikz/lda-gauss-variance-big/Makefile @@ -0,0 +1,33 @@ +SOURCE = lda-gauss-variance-big +DELAY = 80 +DENSITY = 300 +WIDTH = 512 + +make: + pdflatex -shell-escape $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot + +gif: + pdfcrop $(SOURCE).pdf + convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif + make clean + +png: + make + make svg + inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png + +transparentGif: + convert $(SOURCE).pdf -transparent white result.gif + make clean + +svg: + #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg + pdf2svg $(SOURCE).pdf $(SOURCE)1.svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE)1.svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg + rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg + rm $(SOURCE)1.svg \ No newline at end of file diff --git a/tikz/lda-gauss-variance-big/README.md b/tikz/lda-gauss-variance-big/README.md new file mode 100644 index 0000000..e84baeb --- /dev/null +++ b/tikz/lda-gauss-variance-big/README.md @@ -0,0 +1,3 @@ +Compiled example +---------------- +![Example](lda-gauss-variance-big.png) \ No newline at end of file diff --git a/tikz/lda-gauss-variance-big/lda-gauss-variance-big.png b/tikz/lda-gauss-variance-big/lda-gauss-variance-big.png new file mode 100644 index 0000000..093e6d5 Binary files /dev/null and b/tikz/lda-gauss-variance-big/lda-gauss-variance-big.png differ diff --git a/tikz/lda-gauss-variance-big/lda-gauss-variance-big.tex b/tikz/lda-gauss-variance-big/lda-gauss-variance-big.tex new file mode 100644 index 0000000..0d13e02 --- /dev/null +++ b/tikz/lda-gauss-variance-big/lda-gauss-variance-big.tex @@ -0,0 +1,116 @@ +\documentclass[varwidth=true, border=5pt]{article} +\usepackage[active,tightpage]{preview} +\usepackage[latin1]{inputenc} +\usepackage{amsmath} +\usepackage{pgfplots} +\usepackage{tikz} +\usetikzlibrary{arrows,positioning} +\usepackage{helvet} +\usepackage[eulergreek]{sansmath} + +\pgfmathdeclarefunction{gauss}{2}{% + \pgfmathparse{1/(sqrt(2*pi*#2))*exp(-((x-#1)^2)/(2*#2))}% +} +% to be used: \gauss(x)(mean)(variance) + +\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother + +\pgfplotsset{ +tick label style = {font=\sansmath\sffamily}, +every axis label/.append style={font=\sffamily\footnotesize}, +} + +\pgfplotsset{axis line on top/.style={ + axis line style=transparent, + ticklabel style=transparent, + tick style=transparent, + axis on top=false, + after end axis/.append code={ + \pgfplotsset{axis line style=opaque, + ticklabel style=opaque, + tick style=opaque, + grid=none} + \pgfplotsdrawaxis} + } +} + +\tikzset{>=latex} + +\newcommand{\meanI}{80} +\newcommand{\meanII}{40} +\newcommand{\varI}{800} +\newcommand{\varII}{800} + +\newcommand{\arrowHeight}{0.007} +\newcommand{\labelheight}{0.015} + +\pgfmathsetmacro{\meanIheight}{1/(sqrt(2*pi*\varI))}% +\pgfmathsetmacro{\meanIIheight}{1/(sqrt(2*pi*\varII))}% +\pgfmathsetmacro{\plotheight}{max(\meanIheight, \meanIIheight, \labelheight+0.002)}% + +\begin{document} +\begin{preview} +\tikzstyle{plotA}=[ultra thick,red!90!black] +\tikzstyle{plotB}=[ultra thick,cyan!50!black] +\begin{tikzpicture} + \begin{axis}[ + width=13.5cm, + height=8.625cm, + % Grid + grid = major, + grid style={thin, dashed}, + % size + xmin= 0, % start the diagram at this x-coordinate + xmax= 125, % end the diagram at this x-coordinate + ymin= 0, % start the diagram at this y-coordinate + ymax= \plotheight, % end the diagram at this y-coordinate + % Legende + legend style={ + font=\large\sansmath\sffamily, + at={(0.5,-0.18)}, + anchor=north, + legend cell align=left, + legend columns=-1, + column sep=0.5cm + }, + % Ticks + tick align=inside, + scaled y ticks = false, + %xtick={20,30,...,100}, + ytick=\empty, + % Axis + axis lines = middle, + axis line style = very thick, + axis line on top, + axis line style = {very thick,shorten <=-0.5\pgflinewidth}, + xlabel=$x$, + x label style={at={(axis description cs:0.52,0)}, + anchor=north, + font=\boldmath\Large}, + ylabel=$f(x)$, + y label style={at={(axis description cs:0,0.5)}, + anchor=south, + rotate=90, + font=\boldmath\Large}, + ] + + % Mark means + \coordinate (axisOrigin) at (axis cs:0,0); + \coordinate (meanA) at (axis cs:\meanI,\meanIheight); + \draw[black,thick](meanA |- axisOrigin) -- (meanA); + + \coordinate (meanB) at (axis cs:\meanII,\meanIIheight); + \draw[black,thick](meanB |- axisOrigin) -- (meanB); + \draw[black,ultra thick,<->](axis cs:{\meanI-sqrt(\varI)}, \arrowHeight) -- (axis cs:{\meanI+sqrt(\varI)},\arrowHeight); + + % Plots of the distributions + \addplot [domain=0:120,samples=100,plotA] {gauss(\meanI,\varI)}; + \addplot [domain=0:120,samples=100,plotB] {gauss(\meanII,\varII)}; + + % Add labels + \node[plotA,above] at (axis cs:\meanI,\labelheight){\Large $\mathcal{N}(\meanI, \varI)$}; + \node[plotB,above] at (axis cs:\meanII,\labelheight){\Large $\mathcal{N}(\meanII, \varII)$}; + \end{axis} +\end{tikzpicture} +\end{preview} +\end{document}