topology-jordan.tex 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. % Code from Christian Feuersänger
  2. % http://tex.stackexchange.com/questions/54794/using-a-pgfplots-style-legend-in-a-plain-old-tikzpicture#54834
  3. % argument #1: any options
  4. \newenvironment{customlegend}[1][]{%
  5. \begingroup
  6. % inits/clears the lists (which might be populated from previous
  7. % axes):
  8. \csname pgfplots@init@cleared@structures\endcsname
  9. \pgfplotsset{#1}%
  10. }{%
  11. % draws the legend:
  12. \csname pgfplots@createlegend\endcsname
  13. \endgroup
  14. }%
  15. % makes \addlegendimage available (typically only available within an
  16. % axis environment):
  17. \def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
  18. %%--------------------------------
  19. % definition to insert numbers
  20. \pgfkeys{/pgfplots/number in legend/.style={%
  21. /pgfplots/legend image code/.code={%
  22. \node at (0.295,-0.0225){#1};
  23. },%
  24. },
  25. }
  26. \begin{tikzpicture}
  27. \draw[draw=white,pattern=north west lines, pattern color=blue] (-1.5,-1.5) rectangle (1.5,1.5);
  28. \draw[fill=white] (0cm,0cm) circle(1cm);
  29. \draw[fill=white,thick,pattern=dots, pattern color=red] (0cm,0cm) circle(1cm);
  30. \begin{customlegend}[
  31. legend entries={ % <= in the following there are the entries
  32. au{\ss}en,
  33. innen,
  34. Jordankurve
  35. },
  36. legend style={at={(4.5,1.5)},font=\footnotesize}] % <= to define position and font legend
  37. % the following are the "images" and numbers in the legend
  38. \addlegendimage{area legend,pattern=north west lines, pattern color=blue,draw=white}
  39. \addlegendimage{area legend,pattern=dots, pattern color=red,draw=white}
  40. \addlegendimage{thick}
  41. \end{customlegend}
  42. \end{tikzpicture}