ソースを参照

Add texture example

Martin Thoma 9 年 前
コミット
5a45f03548
4 ファイル変更85 行追加0 行削除
  1. 31 0
      tikz/texture/Makefile
  2. 3 0
      tikz/texture/README.md
  3. BIN
      tikz/texture/texture.png
  4. 51 0
      tikz/texture/texture.tex

+ 31 - 0
tikz/texture/Makefile

@@ -0,0 +1,31 @@
+SOURCE  = texture
+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 - 0
tikz/texture/README.md

@@ -0,0 +1,3 @@
+Compiled example
+----------------
+![Example](texture.png)

BIN
tikz/texture/texture.png


+ 51 - 0
tikz/texture/texture.tex

@@ -0,0 +1,51 @@
+\documentclass[varwidth=true, border=2pt]{standalone}
+
+\usepackage{pgfplots}
+\usepackage{tikz}
+\usepackage{nicefrac}
+
+\begin{document}
+\begin{tikzpicture}
+    \begin{axis}[
+        legend pos=south west,
+        axis x line=middle,
+        axis y line=middle,
+        grid = major,
+        %width=9cm,
+        %height=4.5cm,
+        grid style={dashed, gray!30},
+        xmin=-1.25,     % start the diagram at this x-coordinate
+        xmax= 1.25,    % end   the diagram at this x-coordinate
+        ymin=-0.75,     % start the diagram at this y-coordinate
+        ymax= 1.75,   % end   the diagram at this y-coordinate
+        axis background/.style={fill=white},
+        xlabel=$s$,
+        ylabel=$t$,
+        %xticklabels={-2,-1.6,...,7},
+        %yticklabels={-8,-7,...,8},
+        tick align=outside,
+        minor tick num=-3,
+        enlargelimits=true,
+        tension=0.08]
+      % \draw(axis cs:0,0) -- (axis cs:0.5,0) -- (axis cs:0.5,0.5) -- (axis cs:0,0.5) -- (axis cs:0,0);
+      % \node[draw] at (axis cs:0,0) {A};
+      \draw[fill=black!25] (axis cs:0.0,-.7) rectangle (axis cs:0.5,0.5) node[pos=.5] {C};
+      \draw[fill=white]    (axis cs:0.5,-.7) rectangle (axis cs:1.0,0.5) node[pos=.5] {D};
+      \draw[fill=white]    (axis cs:0.0,0.5) rectangle (axis cs:0.5,1.7) node[pos=.5] {A};
+      \draw[fill=black!25] (axis cs:0.5,0.5) rectangle (axis cs:1.0,1.7) node[pos=.5] {B};
+      \draw[fill=black!25] (axis cs:1.0,-.7) rectangle (axis cs:1.5,0.5) node[pos=.5] {C};
+      \draw[fill=white]    (axis cs:1.0,0.5) rectangle (axis cs:1.5,1.7) node[pos=.5] {A};
+      \draw[fill=black!25] (axis cs:-0.5,0.5) rectangle (axis cs:0.0,1.7) node[pos=.5] {B};
+      \draw[fill=white]    (axis cs:-0.5,-.7) rectangle (axis cs:0.0,0.5) node[pos=.5] {D};
+      \draw[fill=black!25] (axis cs:-0.5,-.7) rectangle (axis cs:-1.0,0.5) node[pos=.5] {C};
+      \draw[fill=white]    (axis cs:-0.5,0.5) rectangle (axis cs:-1.0,1.7) node[pos=.5] {A};
+      \draw[fill=black!25] (axis cs:-1.5,0.5) rectangle (axis cs:-1.0,1.7) node[pos=.5] {B};
+      \draw[fill=white]    (axis cs:-1.5,-.7) rectangle (axis cs:-1.0,0.5) node[pos=.5] {D};
+
+      \node[label={180:{1}},circle,fill,inner sep=2pt] at (axis cs:-0.5,-0.5) {};
+      \node[label={180:{2}},circle,fill,inner sep=2pt] at (axis cs:1,-0.5) {};
+      \node[label={180:{3}},circle,fill,inner sep=2pt] at (axis cs:1,1.5) {};
+      \node[label={180:{4}},circle,fill,inner sep=2pt] at (axis cs:-0.5,1.5) {};
+    \end{axis}
+\end{tikzpicture}
+\end{document}