Sfoglia il codice sorgente

added vector versions of my old paintings on wikipedia

Martin Thoma 11 anni fa
parent
commit
5036128de1

+ 33 - 0
tikz/force-distance-diagram-constant/Makefile

@@ -0,0 +1,33 @@
+SOURCE = force-distance-diagram-constant
+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/force-distance-diagram-constant/README.md

@@ -0,0 +1,3 @@
+Compiled example
+----------------
+![Example](force-distance-diagram-constant.png)

BIN
tikz/force-distance-diagram-constant/force-distance-diagram-constant.png


+ 58 - 0
tikz/force-distance-diagram-constant/force-distance-diagram-constant.tex

@@ -0,0 +1,58 @@
+\documentclass[varwidth=true, border=2pt]{standalone}
+
+\usepackage{pgfplots}
+\pgfplotsset{compat=1.10}
+\usepackage{tikz}
+\usepgfplotslibrary{fillbetween}
+\usepackage{mathtools}
+
+\begin{document}
+\begin{tikzpicture}
+    \begin{axis}[
+        width=10cm,
+        height=10cm,
+        % Grid
+        grid = major,
+        % size
+        xmin= 0,     % start the diagram at this x-coordinate
+        xmax= 4.2,   % end   the diagram at this x-coordinate
+        ymin= 0,     % start the diagram at this y-coordinate
+        ymax= 4.2, % end   the diagram at this y-coordinate
+        % Legende
+        legend style={
+            font=\large\sansmath\sffamily,
+            at={(0.5,-0.18)},
+            anchor=north,
+            legend cell align=left,
+            legend columns=-1,
+            column sep=0.5cm
+        },
+        % Ticks
+        tick align=inside,
+        %minor tick num=3,
+        minor tick style={thick},
+        scaled y ticks = false,
+        xtick={0, 1, 2, 3, 4},
+        xticklabels={0, $a$, , $b$,},
+        ytick={0, 1, 2, 3, 4},
+        yticklabels={, , , $c$, },
+        axis lines = middle,
+        axis line style = very thick,
+        xlabel=$x \coloneqq s$,
+        x label style={at={(axis description cs:0.86,0.05)},
+                       anchor=north,
+                       font=\boldmath\Large},
+        ylabel=$y \coloneqq F$,
+        y label style={at={(axis description cs:0,0.5)},
+                       anchor=south,
+                       rotate=90,
+                       font=\boldmath\Large},
+        ]
+      \addplot[domain=0:4, blue, very thick, samples=10, name path=f] {3};
+      \path[name path=axis] (axis cs:0,0) -- (axis cs:10,0);
+      \addplot[fill=green,
+               fill opacity=0.3]
+       fill between[of=f and axis,soft clip={domain=1:3}];
+    \end{axis} 
+\end{tikzpicture}
+\end{document}

+ 33 - 0
tikz/force-distance-diagram/Makefile

@@ -0,0 +1,33 @@
+SOURCE = force-distance-diagram
+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/force-distance-diagram/README.md

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

BIN
tikz/force-distance-diagram/force-distance-diagram.png


+ 57 - 0
tikz/force-distance-diagram/force-distance-diagram.tex

@@ -0,0 +1,57 @@
+\documentclass[varwidth=true, border=2pt]{standalone}
+
+\usepackage{pgfplots}
+\pgfplotsset{compat=1.10}
+\usepackage{tikz}
+\usepgfplotslibrary{fillbetween}
+\usepackage{mathtools}
+
+\begin{document}
+\begin{tikzpicture}
+    \begin{axis}[
+        width=10cm,
+        height=10cm,
+        % Grid
+        grid = major,
+        % size
+        xmin= 0,     % start the diagram at this x-coordinate
+        xmax= 4,   % end   the diagram at this x-coordinate
+        ymin= 0,     % start the diagram at this y-coordinate
+        ymax= 3, % end   the diagram at this y-coordinate
+        % Legende
+        legend style={
+            font=\large\sansmath\sffamily,
+            at={(0.5,-0.18)},
+            anchor=north,
+            legend cell align=left,
+            legend columns=-1,
+            column sep=0.5cm
+        },
+        % Ticks
+        tick align=inside,
+        %minor tick num=3,
+        minor tick style={thick},
+        scaled y ticks = false,
+        xtick={0, 1, 3},
+        xticklabels={0, $a$, $b$},
+        ytick=\empty,
+        axis lines = middle,
+        axis line style = very thick,
+        xlabel=$x \coloneqq s$,
+        x label style={at={(axis description cs:0.88,0.05)},
+                       anchor=north,
+                       font=\boldmath\Large},
+        ylabel=$y \coloneqq F$,
+        y label style={at={(axis description cs:0,0.5)},
+                       anchor=south,
+                       rotate=90,
+                       font=\boldmath\Large},
+        ]
+      \addplot[domain=0:4, blue, very thick, samples=500, name path=f] {sqrt(x)};
+      \path[name path=axis] (axis cs:0,0) -- (axis cs:10,0);
+      \addplot[fill=green,
+               fill opacity=0.3]
+       fill between[of=f and axis,soft clip={domain=1:3}];
+    \end{axis} 
+\end{tikzpicture}
+\end{document}