2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-18 19:18:21 +02:00

2d-light bulb: Plot amortization time

This commit is contained in:
Martin Thoma 2022-03-25 15:05:36 +01:00
parent 66a4216cd7
commit 6d51770034
No known key found for this signature in database
GPG key ID: 6901E782EF663EC4
5 changed files with 87 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -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}

View file

@ -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

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](2d-light-bulb.png)

View file

@ -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}