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

Add line plot for development of student numbers

This commit is contained in:
Martin Thoma 2016-04-12 12:10:50 +02:00
parent 70f383ec49
commit b51af12225
5 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,35 @@
SOURCE = csv-line-plot-kit-students
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:
make
#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
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

View file

@ -0,0 +1,5 @@
Compiled example
----------------
![Example](csv-line-plot-kit-students.png)
Data source: http://web3.karlsruhe.de/Stadtentwicklung/siska/sgt/sgt09230.htm

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,38 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage[margin=2.5cm]{geometry} %layout
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
enlarge y limits=true,
xmin=1986, xmax=2014,
ymin=0, ymax=26000,
width=15cm, height=8cm, % size of the image
grid = major,
grid style={dashed, gray!30},
ylabel=Anzahl,
ylabel style={at={(-0.1,1.0)}},
xlabel=Jahr,
legend style={at={(0.5,1.0)}, anchor=north},
xticklabel style=
{/pgf/number format/1000 sep=,rotate=60,anchor=east,font=\scriptsize},
yticklabel style=
{scaled ticks=false,/pgf/number format/1000 sep=\,,rotate=0,anchor=east,font=\scriptsize},
legend style={draw=none, legend columns=-1}
]
\addplot[thick, blue, mark=x] table [x=year, y=totalStudents, col sep=comma] {students.csv};
\addplot[thick, red, mark=x] table [x=year, y=female, col sep=comma] {students.csv};
\addplot[thick, orange, mark=x] table [x=year, y=foreigners, col sep=comma] {students.csv};
\legend{Eingeschriebene Studenten, davon Frauen, davon Ausländer}
\end{axis}
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,30 @@
year, totalStudents,rueckmelder,neuimmatrikuliert,female,foreigners,foreignFemale
1986, 18515, 15454, 3061, 2826, 1352, 228
1987, 19278, 15888, 3390, 3084, 1425, 272
1988, 20111, 16583, 3528, 3350, 1532, 306
1989, 20716, 16994, 3722, 3545, 1624, 341
1990, 21153, 17385, 3768, 3673, 1759, 380
1991, 21640, 17800, 3840, 3885, 1910, 406
1992, 21782, 18247, 3535, 4044, 2028, 473
1993, 21300, 18170, 3130, 4065, 2032, 512
1994, 20574, 17608, 2966, 4049, 2048, 523
1995, 19312, 16676, 2636, 3977, 2127, 556
1996, 17909, 15302, 2607, 3831, 2098, 565
1997, 16609, 13824, 2785, 3664, 2162, 617
1998, 14753, 12095, 2658, 3326, 2239, 647
1999, 14379, 11276, 3103, 3405, 2455, 729
2000, 15038, 11267, 3771, 3809, 2674, 864
2001, 15686, 11825, 3861, 4217, 2964, 982
2002, 16201, 12581, 3620, 4454, 3265, 1064
2003, 16889, 12934, 3955, 4615, 3408, 1129
2004, 17666, 13441, 4225, 4816, 3701, 1180
2005, 18245, 14012, 4233, 4876, 3764, 1152
2006, 18515, 14274, 4241, 4939, 3661, 1146
2007, 18353, 14372, 3981, 4851, 3495, 1105
2008, 18748, 14424, 4324, 4992, 3321, 1068
2009, 19721, 15315, 4406, 5361, 3395, 1109
2010, 20771, 15867, 4904, 5691, 3466, 1172
2011, 22552, 16599, 5953, 5998, 3543, 1188
2012, 23905, 17736, 6169, 6422, 3859, 1275
2013, 24528, 18088, 6440, 6777, 4192, 1417
2014, 24778, 18137, 6641, 6873, 4587, 1549
1 year totalStudents rueckmelder neuimmatrikuliert female foreigners foreignFemale
2 1986 18515 15454 3061 2826 1352 228
3 1987 19278 15888 3390 3084 1425 272
4 1988 20111 16583 3528 3350 1532 306
5 1989 20716 16994 3722 3545 1624 341
6 1990 21153 17385 3768 3673 1759 380
7 1991 21640 17800 3840 3885 1910 406
8 1992 21782 18247 3535 4044 2028 473
9 1993 21300 18170 3130 4065 2032 512
10 1994 20574 17608 2966 4049 2048 523
11 1995 19312 16676 2636 3977 2127 556
12 1996 17909 15302 2607 3831 2098 565
13 1997 16609 13824 2785 3664 2162 617
14 1998 14753 12095 2658 3326 2239 647
15 1999 14379 11276 3103 3405 2455 729
16 2000 15038 11267 3771 3809 2674 864
17 2001 15686 11825 3861 4217 2964 982
18 2002 16201 12581 3620 4454 3265 1064
19 2003 16889 12934 3955 4615 3408 1129
20 2004 17666 13441 4225 4816 3701 1180
21 2005 18245 14012 4233 4876 3764 1152
22 2006 18515 14274 4241 4939 3661 1146
23 2007 18353 14372 3981 4851 3495 1105
24 2008 18748 14424 4324 4992 3321 1068
25 2009 19721 15315 4406 5361 3395 1109
26 2010 20771 15867 4904 5691 3466 1172
27 2011 22552 16599 5953 5998 3543 1188
28 2012 23905 17736 6169 6422 3859 1275
29 2013 24528 18088 6440 6777 4192 1417
30 2014 24778 18137 6641 6873 4587 1549