mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-18 19:18:21 +02:00
tikz: Germany new car registrtion
This commit is contained in:
parent
6d51770034
commit
2286e6e383
3 changed files with 100 additions and 0 deletions
31
tikz/line-chart-electric-vehicles-sold/Makefile
Normal file
31
tikz/line-chart-electric-vehicles-sold/Makefile
Normal file
|
@ -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
|
3
tikz/line-chart-electric-vehicles-sold/README.md
Normal file
3
tikz/line-chart-electric-vehicles-sold/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Compiled example
|
||||||
|
----------------
|
||||||
|

|
|
@ -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}
|
Loading…
Add table
Add a link
Reference in a new issue