2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00

2d-utility: Added

This commit is contained in:
Martin Thoma 2020-05-14 08:41:46 +02:00
parent 04975e542f
commit 507eed0f98
No known key found for this signature in database
GPG key ID: 94DD4FD95F98B113
4 changed files with 71 additions and 0 deletions

BIN
tikz/2d-utility/2d-caro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -0,0 +1,35 @@
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=south east,
legend cell align={left},
axis x line=middle,
axis y line=middle,
grid = major,
width=11.5cm,
height=6.5cm,
grid style={dashed, gray!30},
xmin=-105.5, % start the diagram at this x-coordinate
xmax= 105.5, % end the diagram at this x-coordinate
ymin=-120.5, % start the diagram at this y-coordinate
ymax= 105.5, % end the diagram at this y-coordinate
axis background/.style={fill=white},
xlabel=$x$,
ylabel=$y$,
tick align=outside,
minor tick num=-3,
]
\addplot[domain=-100:100.0, black, thin, dashed,samples=200] {x};
\addplot[domain=0:100.0, red, thick,samples=200] {x^0.88};
\addplot[domain=-100:0, green, thick,samples=200] {-2*(-x)^0.88};
\addlegendentry{$f(x)= x$}
\addlegendentry{$g_{+}(x)=x^{0.88}$}
\addlegendentry{$g_{-}(x)=-2 \cdot (-x)^{0.88}$}
\end{axis}
\end{tikzpicture}
\end{document}

33
tikz/2d-utility/Makefile Normal file
View file

@ -0,0 +1,33 @@
SOURCE = 2d-caro
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

View file

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