neighbourhood-topology.tex 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{tikz}
  3. \usepackage{pgfplots}
  4. \begin{document}
  5. \begin{tikzpicture}
  6. \begin{axis}[
  7. axis x line=middle,
  8. axis y line=middle,
  9. %width=9cm,
  10. %height=4.5cm,
  11. xmin=-1, % start the diagram at this x-coordinate
  12. xmax= 5, % end the diagram at this x-coordinate
  13. ymin=-1, % start the diagram at this y-coordinate
  14. ymax= 5, % end the diagram at this y-coordinate
  15. xlabel=$X_1$,
  16. ylabel=$X_2$,
  17. ticks=none,
  18. enlargelimits=true,
  19. after end axis/.code={
  20. \draw [decorate,decoration={brace,mirror,raise=15pt}] (axis cs:0,3.6) -- (axis cs:0,2.5) node [midway,left=20pt] {$U_2$};
  21. \draw [decorate,decoration={brace,mirror,raise=12pt}] (axis cs:1.5,0) -- (axis cs:2.5,0) node [midway,below=16pt] {$U_1$};
  22. }]
  23. \addplot[mark=none, orange, smooth cycle, thick, fill=orange!30] coordinates {(1,1) (2,0.5) (3,1.5) (3,2) (3.5,3) (3.2, 5) (2.2, 4.7) (1.5, 4.2) (1.1, 3.9) (0.9, 2.5)};
  24. \node[orange] at (axis cs:4,4) [anchor=south] {$U$};
  25. % Draw help lines
  26. \addplot[dashed] coordinates {(1.5,0) (1.5,3.6)};
  27. \addplot[dashed] coordinates {(2.5,0) (2.5,3.6)};
  28. \addplot[dashed] coordinates {(0,2.5) (2.5,2.5)};
  29. \addplot[dashed] coordinates {(0,3.6) (2.5,3.6)};
  30. % Draw solid square
  31. \addplot[mark=none, red, thick, fill=red!30] coordinates {(2.5,2.5) (2.5,3.6) (1.5,3.6) (1.5,2.5) (2.5,2.5)};
  32. % Draw x and annotation
  33. \node[blue] at (axis cs:2,3) [anchor=south west] {$x$};
  34. \addplot[mark=*, blue] coordinates {(2,3)};
  35. % Draw ticks of help lines
  36. \addplot[mark=none, red, thick] coordinates {(1.5, -0.1) (1.5,0.1)};
  37. \addplot[mark=none, red, thick] coordinates {(2.5, -0.1) (2.5,0.1)};
  38. \addplot[mark=none, red, thick] coordinates {(-0.1, 2.5) (0.1,2.5)};
  39. \addplot[mark=none, red, thick] coordinates {(-0.1, 3.6) (0.1,3.6)};
  40. % Draw axis text
  41. \node[blue] at (axis cs:0,3) [anchor=east] {$x_2$};
  42. \node[blue] at (axis cs:2,0) [anchor=north] {$x_1$};
  43. \end{axis}
  44. \end{tikzpicture}
  45. \end{document}