From 2286e6e3833904b2c058b2a855db9b7f81776c59 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sat, 19 Oct 2024 11:22:38 +0200 Subject: [PATCH] tikz: Germany new car registrtion --- .../Makefile | 31 +++++++++ .../README.md | 3 + .../line-chart-electric-vehicles-sold.tex | 66 +++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 tikz/line-chart-electric-vehicles-sold/Makefile create mode 100644 tikz/line-chart-electric-vehicles-sold/README.md create mode 100644 tikz/line-chart-electric-vehicles-sold/line-chart-electric-vehicles-sold.tex diff --git a/tikz/line-chart-electric-vehicles-sold/Makefile b/tikz/line-chart-electric-vehicles-sold/Makefile new file mode 100644 index 0000000..c1ea418 --- /dev/null +++ b/tikz/line-chart-electric-vehicles-sold/Makefile @@ -0,0 +1,31 @@ +SOURCE = line-chart-electric-vehicles-sold +DELAY = 80 +DENSITY = 300 +WIDTH = 1000 + +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-plain-svg=$(SOURCE).svg diff --git a/tikz/line-chart-electric-vehicles-sold/README.md b/tikz/line-chart-electric-vehicles-sold/README.md new file mode 100644 index 0000000..5e5dda9 --- /dev/null +++ b/tikz/line-chart-electric-vehicles-sold/README.md @@ -0,0 +1,3 @@ +Compiled example +---------------- +![Example](logistic-functions.png) diff --git a/tikz/line-chart-electric-vehicles-sold/line-chart-electric-vehicles-sold.tex b/tikz/line-chart-electric-vehicles-sold/line-chart-electric-vehicles-sold.tex new file mode 100644 index 0000000..eec76a8 --- /dev/null +++ b/tikz/line-chart-electric-vehicles-sold/line-chart-electric-vehicles-sold.tex @@ -0,0 +1,66 @@ +\documentclass{standalone} +\usepackage{pgfplots} +\usepackage{pgfplotstable} +\usepgfplotslibrary{fillbetween} +\usetikzlibrary{arrows.meta, positioning, backgrounds} + +\begin{document} + +\begin{tikzpicture} + \begin{axis}[ + title={Percentage of Electric Cars in Overall New Car Registrations in Germany}, + width=14cm, + height=9cm, + xmin=2012, xmax=2023, + ymin=0, ymax=20, + xtick={2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023}, + ytick={0,2,4,6,8,10,12,14,16,18,20}, + xticklabels={2012\\2956,2013\\6051,2014\\8522,2015\\12363,2016\\11410,2017\\25056,2018\\36062,2019\\63281,2020\\194163,2021\\355961,2022\\470559,2023\\524219}, + xticklabel style={/pgf/number format/1000 sep=}, + xticklabel style={rotate=0, anchor=north, align=center}, + yticklabel pos=right, + yticklabel={ + \pgfmathprintnumber{\tick}\,\% + }, + grid=both, + major grid style={line width=.2pt,draw=gray!50}, + minor grid style={line width=.1pt,draw=gray!20}, + thick, + every axis plot/.append style={thick}, + every mark/.append style={scale=1.2}, + legend style={draw=none, at={(0.95,0.05)}, anchor=south east, fill=none, font=\small}, + title style={font=\bfseries, align=center, yshift=10pt}, + tick label style={font=\footnotesize}, + ] + \addplot[ + color=blue, + mark=*, + mark options={fill=blue}, + line width=1.2pt + ] coordinates { + (2012, 0.1) + (2013, 0.2) + (2014, 0.3) + (2015, 0.4) + (2016, 0.3) + (2017, 0.7) + (2018, 1.0) + (2019, 1.8) + (2020, 6.7) + (2021, 13.6) + (2022, 17.7) + (2023, 18.4) + }; + + % Add annotation for Tesla Model 3 + \node[fill=none, text=black, align=center, font=\small, anchor=south east] (model3) at (axis cs:2019,5) {Tesla Model 3\\introduced}; + \draw[{Latex[length=3mm, width=2mm]}-, thick] (axis cs:2019,1.8) -- (model3); + + % Add annotation for Tesla Model Y + \node[fill=none, text=black, align=center, font=\small, anchor=east] (modely) at (axis cs:2021,16) {Tesla Model Y\\introduced}; + \draw[{Latex[length=3mm, width=2mm]}-, thick] (axis cs:2021,13.6) -- (modely); + + \end{axis} +\end{tikzpicture} + +\end{document} \ No newline at end of file