浏览代码

Add XOR problem graphic

Martin Thoma 9 年之前
父节点
当前提交
2ec24b14b8
共有 4 个文件被更改,包括 71 次插入0 次删除
  1. 33 0
      tikz/xor-problem/Makefile
  2. 3 0
      tikz/xor-problem/README.md
  3. 二进制
      tikz/xor-problem/xor-problem.png
  4. 35 0
      tikz/xor-problem/xor-problem.tex

+ 33 - 0
tikz/xor-problem/Makefile

@@ -0,0 +1,33 @@
+SOURCE = xor-problem
+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-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
+	rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
+	rm $(SOURCE)1.svg

+ 3 - 0
tikz/xor-problem/README.md

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

二进制
tikz/xor-problem/xor-problem.png


+ 35 - 0
tikz/xor-problem/xor-problem.tex

@@ -0,0 +1,35 @@
+\documentclass[varwidth=true, border=2pt]{standalone}
+
+\usepackage{pgfplots}
+\usepackage{tikz}
+\usepackage{tkz-fct}
+\usetikzlibrary{shapes.misc}
+
+\begin{document}
+\begin{tikzpicture}
+    \tikzstyle{point}=[thick,draw=black,cross out,inner sep=0pt,minimum width=4pt,minimum height=4pt]
+    \begin{axis}[
+        legend pos=south west,
+        axis x line=middle,
+        axis y line=middle,
+        grid = major,
+        width=6cm,
+        height=6cm,
+        grid style={dashed, gray!30},
+        xmin=0,    % start the diagram at this x-coordinate
+        xmax=1,    % end   the diagram at this x-coordinate
+        ymin=0,    % start the diagram at this y-coordinate
+        ymax=1,    % end   the diagram at this y-coordinate
+        xlabel=$x$,
+        ylabel=$y$,
+        tick align=outside,
+        minor tick num=-3,
+        enlargelimits=true]
+      % \addplot[domain=0:2.5, red, thick,samples=20] {-x+2.5};
+      \node[point,label={[label distance=0cm,text=red]135:$0$},red] at (axis cs:1,0) {};
+      \node[point,label={[label distance=0cm,text=red]-45:$0$},red] at (axis cs:0,1) {};
+      \node[point,label={[label distance=0cm,text=blue]45:$1$},blue] at (axis cs:0,0) {};
+      \node[point,label={[label distance=0cm,text=blue]-135:$1$},blue] at (axis cs:1,1) {};
+    \end{axis}
+\end{tikzpicture}
+\end{document}