csv-line-plot-two-axes.tex 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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{pgfplots}
  7. \begin{document}
  8. \begin{tikzpicture}
  9. \begin{axis}[
  10. axis x line=middle,
  11. axis y line=middle,
  12. enlarge y limits=true,
  13. xmin=0, xmax=2150,
  14. ymin=0, ymax=20000000,
  15. width=15cm, height=8cm, % size of the image
  16. grid = major,
  17. grid style={dashed, gray!30},
  18. ylabel=Stored game situations,
  19. xlabel=seconds,
  20. legend style={at={(0.1,-0.1)}, anchor=north}
  21. ]
  22. \addplot table [x=seconds, y=situations, col sep=comma] {linearProbing.csv};
  23. \addplot table [x=seconds, y=situations, col sep=comma] {quadraticProbing.csv};
  24. \legend{linear probing,quadratic probing}
  25. \end{axis}
  26. % this is the right axis
  27. \begin{axis}[
  28. hide x axis,
  29. axis y line*=right,
  30. width=15cm, height=8cm, % size of the image
  31. ]
  32. \addplot[orange, mark=halfcircle] table [x=seconds, y=mirrored, col sep=comma] {linearProbing.csv};
  33. \addplot[black, mark=x] table [x=seconds, y=mirrored, col sep=comma] {quadraticProbing.csv};
  34. \end{axis}
  35. \end{tikzpicture}
  36. \end{document}