csv-2d-gaussian-multivarate-distributions.tex 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. \documentclass[varwidth=true, border=5pt]{article}
  2. \usepackage[active,tightpage]{preview}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage{amsmath}
  5. \usepackage{pgfplots}
  6. \pgfplotsset{compat=1.10}
  7. \usepackage{tikz}
  8. \usetikzlibrary{arrows, positioning}
  9. \usepackage{helvet}
  10. \usepackage[eulergreek]{sansmath}
  11. \begin{document}
  12. \begin{preview}
  13. \begin{tikzpicture}
  14. \begin{axis}[
  15. width=13.4cm,
  16. height=10.0cm,
  17. % Grid
  18. grid = major,
  19. % size
  20. xmin= 40, % start the diagram at this x-coordinate
  21. xmax= 90, % end the diagram at this x-coordinate
  22. ymin= 0, % start the diagram at this y-coordinate
  23. ymax= 60, % end the diagram at this y-coordinate
  24. % Legende
  25. legend style={
  26. font=\large\sansmath\sffamily,
  27. at={(0.5,-0.18)},
  28. anchor=north,
  29. legend cell align=left,
  30. legend columns=-1,
  31. column sep=0.5cm
  32. },
  33. % Ticks
  34. tick align=inside,
  35. every axis/.append style={font=\large\sansmath\sffamily},
  36. minor tick style={thick},
  37. scaled y ticks = false,
  38. % Axis
  39. axis line style = {very thick,shorten <=-0.5\pgflinewidth},
  40. axis lines = middle,
  41. axis line style = very thick,
  42. xlabel=Gesamtausgaben,
  43. x label style={at={(axis description cs:0.5,-0.05)},
  44. anchor=north,
  45. font=\boldmath\sansmath\sffamily\Large},
  46. ylabel=Luxusausgaben,
  47. y label style={at={(axis description cs:-0.05,0.5)},
  48. anchor=south,
  49. rotate=90,
  50. font=\boldmath\sansmath\sffamily\Large}
  51. ]
  52. \addplot[
  53. scatter,
  54. only marks,
  55. point meta=explicit symbolic,
  56. scatter/classes={
  57. a={mark=x,red!90!black},%
  58. b={mark=x,cyan!50!black}},
  59. ]
  60. table[col sep=comma, meta=label] {data.csv};
  61. \addplot[
  62. scatter,
  63. only marks,
  64. point meta=explicit symbolic,
  65. scatter/classes={
  66. b={mark=*,mark size=4pt,red!30!white,draw=black},%
  67. c={mark=*,mark size=4pt,cyan!30!white,draw=black},%
  68. a={mark=*,mark size=4pt,green!70!black,draw=black,pin=135:{\color{black}$(65, 35)$},label={(65, 35)}] {}}},
  69. ]
  70. table[meta=label] {
  71. x y label
  72. 65 35 a
  73. 70 40 b
  74. 60 20 c
  75. };
  76. % \addlegendentry{Gruppe 1}
  77. % \addlegendentry{Gruppe 2}
  78. \end{axis}
  79. \end{tikzpicture}
  80. \end{preview}
  81. \end{document}