csv-line-plot-kit-students.tex 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage[utf8]{inputenc} % this is needed for umlauts
  3. \usepackage[ngerman]{babel} % this is needed for umlauts
  4. \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
  5. \usepackage[margin=2.5cm]{geometry} %layout
  6. \usepackage{tikz}
  7. \usepackage{pgfplots}
  8. \pgfplotsset{compat=1.12}
  9. \begin{document}
  10. \begin{tikzpicture}
  11. \begin{axis}[
  12. axis x line=middle,
  13. axis y line=middle,
  14. enlarge y limits=true,
  15. xmin=1986, xmax=2014,
  16. ymin=0, ymax=26000,
  17. width=15cm, height=8cm, % size of the image
  18. grid = major,
  19. grid style={dashed, gray!30},
  20. ylabel=Anzahl,
  21. ylabel style={at={(-0.1,1.0)}},
  22. xlabel=Jahr,
  23. legend style={at={(0.5,1.0)}, anchor=north},
  24. xticklabel style=
  25. {/pgf/number format/1000 sep=,rotate=60,anchor=east,font=\scriptsize},
  26. yticklabel style=
  27. {scaled ticks=false,/pgf/number format/1000 sep=\,,rotate=0,anchor=east,font=\scriptsize},
  28. legend style={draw=none, legend columns=-1}
  29. ]
  30. \addplot[thick, blue, mark=x] table [x=year, y=totalStudents, col sep=comma] {students.csv};
  31. \addplot[thick, red, mark=x] table [x=year, y=female, col sep=comma] {students.csv};
  32. \addplot[thick, orange, mark=x] table [x=year, y=foreigners, col sep=comma] {students.csv};
  33. \legend{Eingeschriebene Studenten, davon Frauen, davon Ausländer}
  34. \end{axis}
  35. \end{tikzpicture}
  36. \end{document}