Browse Source

Add line plot for development of student numbers

Martin Thoma 9 years ago
parent
commit
b51af12225

+ 35 - 0
tikz/csv-line-plot-kit-students/Makefile

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

+ 5 - 0
tikz/csv-line-plot-kit-students/README.md

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

BIN
tikz/csv-line-plot-kit-students/csv-line-plot-kit-students.png


+ 38 - 0
tikz/csv-line-plot-kit-students/csv-line-plot-kit-students.tex

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

+ 30 - 0
tikz/csv-line-plot-kit-students/students.csv

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