diff --git a/tikz/2d-light-bulb/2d-light-bulb.png b/tikz/2d-light-bulb/2d-light-bulb.png new file mode 100644 index 0000000..377b5a6 Binary files /dev/null and b/tikz/2d-light-bulb/2d-light-bulb.png differ diff --git a/tikz/2d-light-bulb/2d-light-bulb.tex b/tikz/2d-light-bulb/2d-light-bulb.tex new file mode 100644 index 0000000..ed0fdf6 --- /dev/null +++ b/tikz/2d-light-bulb/2d-light-bulb.tex @@ -0,0 +1,12 @@ +\documentclass[border=2pt]{standalone} + +\usepackage{pgfplots} +\usepackage{tikz} +\usepackage{xcolor} +\usetikzlibrary{positioning} +\usetikzlibrary{decorations.text} +\usetikzlibrary{decorations.pathmorphing} + +\begin{document} +\input{overfitting} +\end{document} diff --git a/tikz/2d-light-bulb/Makefile b/tikz/2d-light-bulb/Makefile new file mode 100644 index 0000000..b25632a --- /dev/null +++ b/tikz/2d-light-bulb/Makefile @@ -0,0 +1,33 @@ +SOURCE = 2d-light-bulb +DELAY = 80 +DENSITY = 300 +WIDTH = 512 + +make: + pdflatex $(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).svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE).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 diff --git a/tikz/2d-light-bulb/README.md b/tikz/2d-light-bulb/README.md new file mode 100644 index 0000000..9470803 --- /dev/null +++ b/tikz/2d-light-bulb/README.md @@ -0,0 +1,3 @@ +Compiled example +---------------- +![Example](2d-light-bulb.png) diff --git a/tikz/2d-light-bulb/overfitting.tex b/tikz/2d-light-bulb/overfitting.tex new file mode 100644 index 0000000..2a08f17 --- /dev/null +++ b/tikz/2d-light-bulb/overfitting.tex @@ -0,0 +1,39 @@ +\definecolor{c1}{HTML}{0072B2} +\definecolor{c2}{HTML}{009E73} +\begin{tikzpicture} + \tikzstyle{training}=[c1, thick,samples=200,dashed] + \tikzstyle{testing}=[c2, thick,samples=200] + \begin{axis}[ + legend pos=north east, + legend cell align=left, + axis x line=middle, + axis y line=middle, + grid = major, + width=14cm, + height=8cm, + grid style={dashed, gray!30}, + xmin=5, % start the diagram at this x-coordinate + xmax=100, % end the diagram at this x-coordinate + ymin=0, % start the diagram at this y-coordinate + ymax=350, % end the diagram at this y-coordinate + axis background/.style={fill=white}, + xlabel=Energy savings, + ylabel={Amortization time\\in h}, + y label style={at={(-0.1,1.0)}}, + tick align=outside, + minor tick num=-3, + tension=0.08] + + \addplot[domain=5:100, red, solid, samples=200] {1.50 / (0.003 * x)}; + \addplot[domain=5:100, green, dashed, samples=200] {3.00 / (0.003 * x)}; + \addplot[domain=5:100, blue, dotted, samples=200] {5.00 / (0.003 * x)}; + + %\draw[dashed, very thick] (axis cs:50,0.0) -- (axis cs:50,0.3); + %\draw[decoration={text along path, text={overfitting}, text align={center}}, decorate] (axis cs:51,0.16) -- (axis cs:90,0.16); + %\draw[-{latex[scale=3.0]}, very thick] (axis cs:51,0.15) -- (axis cs:90,0.15); + + \addlegendentry{1.50 EUR and 0.30 EUR/kWh} + \addlegendentry{3.00 EUR and 0.30 EUR/kWh} + \addlegendentry{5.00 EUR and 0.30 EUR/kWh} + \end{axis} +\end{tikzpicture}