mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
added neighborhood topology example
This commit is contained in:
parent
c5cd05a761
commit
6295f19fcc
4 changed files with 87 additions and 0 deletions
31
tikz/neighbourhood-topology/Makefile
Normal file
31
tikz/neighbourhood-topology/Makefile
Normal file
|
@ -0,0 +1,31 @@
|
|||
SOURCE = neighbourhood-topology
|
||||
DELAY = 80
|
||||
DENSITY = 300
|
||||
WIDTH = 512
|
||||
|
||||
make:
|
||||
pdflatex $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||
|
||||
gif:
|
||||
pdfcrop $(SOURCE).pdf
|
||||
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||
make clean
|
||||
|
||||
png:
|
||||
make
|
||||
make svg
|
||||
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||
|
||||
transparentGif:
|
||||
convert $(SOURCE).pdf -transparent white result.gif
|
||||
make clean
|
||||
|
||||
svg:
|
||||
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
3
tikz/neighbourhood-topology/Readme.md
Normal file
3
tikz/neighbourhood-topology/Readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
BIN
tikz/neighbourhood-topology/neighbourhood-topology.png
Normal file
BIN
tikz/neighbourhood-topology/neighbourhood-topology.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
53
tikz/neighbourhood-topology/neighbourhood-topology.tex
Normal file
53
tikz/neighbourhood-topology/neighbourhood-topology.tex
Normal file
|
@ -0,0 +1,53 @@
|
|||
\documentclass[varwidth=true, border=2pt]{standalone}
|
||||
\usepackage{tikz}
|
||||
\usepackage{pgfplots}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}[>=stealth,]
|
||||
\begin{axis}[
|
||||
axis x line=middle,
|
||||
axis y line=middle,
|
||||
%width=9cm,
|
||||
%height=4.5cm,
|
||||
xmin=-1, % start the diagram at this x-coordinate
|
||||
xmax= 5, % end the diagram at this x-coordinate
|
||||
ymin=-1, % start the diagram at this y-coordinate
|
||||
ymax= 5, % end the diagram at this y-coordinate
|
||||
xlabel=$X_1$,
|
||||
ylabel=$X_2$,
|
||||
ticks=none,
|
||||
enlargelimits=true,
|
||||
after end axis/.code={
|
||||
\draw [decorate,decoration={brace,mirror,raise=15pt}] (axis cs:0,3.6) -- (axis cs:0,2.5) node [midway,left=20pt] {$U_2$};
|
||||
\draw [decorate,decoration={brace,mirror,raise=12pt}] (axis cs:1.5,0) -- (axis cs:2.5,0) node [midway,below=16pt] {$U_1$};
|
||||
}]
|
||||
|
||||
\addplot[mark=none, orange, smooth, 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) (1,1)};
|
||||
\node[orange] at (axis cs:4,4) [anchor=south] {$U$};
|
||||
|
||||
% Draw help lines
|
||||
\addplot[dashed] coordinates {(1.5,0) (1.5,3.6)};
|
||||
\addplot[dashed] coordinates {(2.5,0) (2.5,3.6)};
|
||||
\addplot[dashed] coordinates {(0,2.5) (2.5,2.5)};
|
||||
\addplot[dashed] coordinates {(0,3.6) (2.5,3.6)};
|
||||
|
||||
% Draw solid square
|
||||
\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)};
|
||||
|
||||
% Draw x and annotation
|
||||
\node[blue] at (axis cs:2,3) [anchor=south west] {$x$};
|
||||
\addplot[mark=*, blue] coordinates {(2,3)};
|
||||
|
||||
% Draw ticks of help lines
|
||||
\addplot[mark=none, red, thick] coordinates {(1.5, -0.1) (1.5,0.1)};
|
||||
\addplot[mark=none, red, thick] coordinates {(2.5, -0.1) (2.5,0.1)};
|
||||
\addplot[mark=none, red, thick] coordinates {(-0.1, 2.5) (0.1,2.5)};
|
||||
\addplot[mark=none, red, thick] coordinates {(-0.1, 3.6) (0.1,3.6)};
|
||||
|
||||
% Draw axis text
|
||||
\node[blue] at (axis cs:0,3) [anchor=east] {$x_2$};
|
||||
\node[blue] at (axis cs:2,0) [anchor=north] {$x_1$};
|
||||
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue