topology-3.tex 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. \newenvironment{customlegend}[1][]{%
  2. \begingroup
  3. % inits/clears the lists (which might be populated from previous
  4. % axes):
  5. \csname pgfplots@init@cleared@structures\endcsname
  6. \pgfplotsset{#1}%
  7. }{%
  8. % draws the legend:
  9. \csname pgfplots@createlegend\endcsname
  10. \endgroup
  11. }%
  12. % makes \addlegendimage available (typically only available within an
  13. % axis environment):
  14. \def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
  15. %%--------------------------------
  16. % definition to insert numbers
  17. \pgfkeys{/pgfplots/number in legend/.style={%
  18. /pgfplots/legend image code/.code={%
  19. \node at (0.295,-0.0225){#1};
  20. },%
  21. },
  22. }
  23. \pgfdeclarelayer{background}
  24. \pgfdeclarelayer{foreground}
  25. \pgfsetlayers{background,main,foreground}
  26. \begin{tikzpicture}
  27. \tkzSetUpPoint[shape=circle,size=10,color=black,fill=black]
  28. \tkzDefPoints{0/0/A, 2/0/B, 3/0.5/C, 0/3/D, 2/3/E, 3/1.5/F, 2/2/G, 1/1.5/H}
  29. \begin{pgfonlayer}{foreground}
  30. %Get intersections
  31. \tkzInterLL(B,H)(A,C) \tkzGetPoint{I}
  32. \tkzInterLL(B,F)(A,C) \tkzGetPoint{J}
  33. \tkzInterLL(A,G)(B,H) \tkzGetPoint{K}
  34. \tkzInterLL(A,G)(H,F) \tkzGetPoint{L}
  35. \tkzInterLL(C,G)(B,F) \tkzGetPoint{M}
  36. \tkzInterLL(C,G)(H,F) \tkzGetPoint{N}
  37. \tkzInterLL(G,D)(H,E) \tkzGetPoint{O}
  38. \tkzDrawPoints[color=green,fill=green](A,C,G,D)
  39. \tkzDrawPoints[color=blue,fill=blue](B,F,E,H)
  40. \tkzDrawPoints[color=red,fill=red](I,J,K,L,M,N,O)
  41. \end{pgfonlayer}
  42. \tkzDrawPolygon[blue,very thick](H,E,F,B)
  43. \tkzDrawSegment[blue,very thick](H,F)
  44. \tkzDrawPolygon[green,very thick](A,D,G,C)
  45. \tkzDrawSegment[green,very thick](A,G)
  46. \tkzDrawSegments[red,very thick](I,M I,N I,L A,H H,D L,O N,E G,E)
  47. % \tkzLabelPoint(A){A}
  48. % \tkzLabelPoint(B){B}
  49. % \tkzLabelPoint(C){C}
  50. % \tkzLabelPoint(D){D}
  51. % \tkzLabelPoint(E){E}
  52. % \tkzLabelPoint(F){F}
  53. % \tkzLabelPoint(G){G}
  54. % \tkzLabelPoint(H){H}
  55. % \tkzLabelPoint(I){I}
  56. % \tkzLabelPoint(J){J}
  57. % \tkzLabelPoint(K){K}
  58. % \tkzLabelPoint(L){L}
  59. % \tkzLabelPoint(M){M}
  60. % \tkzLabelPoint(N){N}
  61. % \tkzLabelPoint(O){O}
  62. \begin{customlegend}[
  63. legend entries={
  64. $T_1$,
  65. $T_2$,
  66. $T$
  67. },
  68. legend style={at={(4.5,3.5)},font=\footnotesize}] % <= to define position and font legend
  69. % the following are the "images" and numbers in the legend
  70. \addlegendimage{blue,very thick}
  71. \addlegendimage{green,very thick}
  72. \addlegendimage{red,very thick}
  73. \end{customlegend}
  74. \end{tikzpicture}