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

tikz/3d-gradient-colored: added

This commit is contained in:
Martin Thoma 2015-02-08 12:32:16 +01:00
parent b25f227dea
commit 8de0289e53
5 changed files with 431 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -0,0 +1,47 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage{tikz}
\begin{document}
\pgfplotsset{
colormap={whitered}{
color(0.000cm)=(blue!50!black);
color(0.125cm)=(blue);
color(0.250cm)=(SkyBlue);
color(0.375cm)=(SkyBlue);
color(0.500cm)=(SpringGreen);
color(0.625cm)=(yellow);
color(0.750cm)=(yellow);
color(0.875cm)=(red);
color(1.000cm)=(red!50!black)
}
}
\begin{tikzpicture}
\begin{axis}[
domain=-2:2,
view={0}{90},
axis background/.style={fill=white},
]
\addplot3[surf,
samples=50,
shader=interp,
colormap name=whitered]
{x/exp(x^2+y^2)};
% \addplot3[contour gnuplot={number=15, labels=false},
% very thick,
% samples=30]
% {x/exp(x^2+y^2)};
\addplot3[blue,
quiver={
u={(1-2*x^2)*exp(-x^2-y^2)},
v={-2*x*y*exp(-x^2-y^2)},
scale arrows=0.3,
},
-stealth,samples=15]
{x/exp(x^2+y^2)};
\end{axis}
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,341 @@
# Surface 0 of 1 surfaces
# Curve title: ""3d-gradient-colored_contourtmp0.dat""
# Contour 0, label: 0.4
0.62067 0.228107 0.4
0.604191 0.20688 0.4
0.550241 0.06895 0.4
0.550241 -0.06898 0.4
0.604214 -0.20691 0.4
0.62067 -0.228102 0.4
0.7586 -0.247438 0.4
0.808601 -0.20691 0.4
0.893435 -0.06898 0.4
0.893435 0.06895 0.4
0.808627 0.20688 0.4
0.7586 0.247435 0.4
0.62067 0.228107 0.4
# Contour 1, label: 0.3
0.48274 0.492135 0.3
0.476086 0.48274 0.3
0.402176 0.34481 0.3
0.357394 0.20688 0.3
0.34481 0.126098 0.3
0.338757 0.06895 0.3
0.338763 -0.06898 0.3
0.34481 -0.126077 0.3
0.357401 -0.20691 0.3
0.402195 -0.34484 0.3
0.476105 -0.48277 0.3
0.48274 -0.49214 0.3
0.62067 -0.583459 0.3
0.7586 -0.59254 0.3
0.89653 -0.537769 0.3
0.9635 -0.48277 0.3
1.03446 -0.405831 0.3
1.07457 -0.34484 0.3
1.13322 -0.20691 0.3
1.16092 -0.06898 0.3
1.16092 0.06895 0.3
1.13323 0.20688 0.3
1.07457 0.34481 0.3
1.03446 0.405819 0.3
0.963553 0.48274 0.3
0.89653 0.537785 0.3
0.7586 0.592536 0.3
0.62067 0.583452 0.3
0.48274 0.492135 0.3
# Contour 2, label: 0.2
0.48274 0.805972 0.2
0.434239 0.7586 0.2
0.34481 0.652343 0.2
0.329248 0.62067 0.2
0.276215 0.48274 0.2
0.241422 0.34481 0.2
0.220336 0.20688 0.2
0.210381 0.06895 0.2
0.210382 -0.06898 0.2
0.220339 -0.20691 0.2
0.241428 -0.34484 0.2
0.27623 -0.48277 0.2
0.329266 -0.6207 0.2
0.34481 -0.652337 0.2
0.434266 -0.75863 0.2
0.48274 -0.805975 0.2
0.62067 -0.865282 0.2
0.7586 -0.87119 0.2
0.89653 -0.835618 0.2
1.03204 -0.75863 0.2
1.03446 -0.757113 0.2
1.17239 -0.627608 0.2
1.17819 -0.6207 0.2
1.27174 -0.48277 0.2
1.31032 -0.399731 0.2
1.33454 -0.34484 0.2
1.37411 -0.20691 0.2
1.39279 -0.06898 0.2
1.39279 0.06895 0.2
1.37412 0.20688 0.2
1.33456 0.34481 0.2
1.31032 0.399737 0.2
1.27172 0.48274 0.2
1.17825 0.62067 0.2
1.17239 0.627653 0.2
1.03446 0.757115 0.2
1.03209 0.7586 0.2
0.89653 0.835623 0.2
0.7586 0.871183 0.2
0.62067 0.865281 0.2
0.48274 0.805972 0.2
# Contour 3, label: 0.1
0.62067 1.20274 0.1
0.527412 1.17239 0.1
0.48274 1.15931 0.1
0.34481 1.05953 0.1
0.326152 1.03446 0.1
0.239045 0.89653 0.1
0.20688 0.828226 0.1
0.185143 0.7586 0.1
0.152362 0.62067 0.1
0.130273 0.48274 0.1
0.115781 0.34481 0.1
0.107 0.20688 0.1
0.102853 0.06895 0.1
0.102853 -0.06898 0.1
0.107001 -0.20691 0.1
0.115784 -0.34484 0.1
0.130279 -0.48277 0.1
0.152369 -0.6207 0.1
0.185151 -0.75863 0.1
0.20688 -0.828228 0.1
0.239059 -0.89656 0.1
0.326174 -1.03449 0.1
0.34481 -1.05953 0.1
0.48274 -1.15931 0.1
0.527503 -1.17242 0.1
0.62067 -1.20274 0.1
0.7586 -1.20736 0.1
0.89653 -1.17953 0.1
0.914319 -1.17242 0.1
1.03446 -1.12812 0.1
1.17239 -1.04335 0.1
1.18365 -1.03449 0.1
1.31032 -0.926516 0.1
1.33897 -0.89656 0.1
1.44825 -0.758644 0.1
1.53381 -0.6207 0.1
1.58618 -0.497219 0.1
1.59273 -0.48277 0.1
1.6398 -0.34484 0.1
1.66832 -0.20691 0.1
1.68179 -0.06898 0.1
1.68179 0.06895 0.1
1.66832 0.20688 0.1
1.63981 0.34481 0.1
1.59275 0.48274 0.1
1.58618 0.497228 0.1
1.53383 0.62067 0.1
1.44828 0.7586 0.1
1.44825 0.75864 0.1
1.33899 0.89653 0.1
1.31032 0.92651 0.1
1.18369 1.03446 0.1
1.17239 1.04335 0.1
1.03446 1.12813 0.1
0.914383 1.17239 0.1
0.89653 1.17953 0.1
0.7586 1.20736 0.1
0.62067 1.20274 0.1
# Contour 4, label: 0
4.89094e-08 1.99997 0
-6.26617e-08 1.86204 0
-1.1295e-07 1.72411 0
1.42801e-08 1.58618 0
1.04787e-07 1.44825 0
3.47799e-07 1.31032 0
5.77227e-08 1.17239 0
-9.48916e-08 1.03446 0
3.16071e-09 0.89653 0
-1.18704e-07 0.7586 0
1.03236e-07 0.62067 0
5.89748e-08 0.48274 0
-6.07234e-07 0.34481 0
-3.00826e-07 0.20688 0
5.76332e-08 0.06895 0
-3.96564e-07 -0.06898 0
-5.10344e-07 -0.20691 0
7.21164e-08 -0.34484 0
-6.73148e-08 -0.48277 0
-4.38438e-08 -0.6207 0
-2.8782e-08 -0.75863 0
4.09067e-09 -0.89656 0
-9.38127e-08 -1.03449 0
-5.36999e-07 -1.17242 0
-2.10373e-07 -1.31035 0
1.06225e-07 -1.44828 0
-4.81826e-07 -1.58621 0
-1.30033e-08 -1.72414 0
-6.11936e-08 -1.86207 0
5.07091e-08 -2 0
# Contour 5, label: -0.1
-0.89656 1.17953 -0.1
-0.914403 1.17239 -0.1
-1.03449 1.12813 -0.1
-1.17242 1.04333 -0.1
-1.1837 1.03446 -0.1
-1.31035 0.926487 -0.1
-1.339 0.89653 -0.1
-1.44828 0.7586 -0.1
-1.53382 0.62067 -0.1
-1.58621 0.497151 -0.1
-1.59274 0.48274 -0.1
-1.6398 0.34481 -0.1
-1.66832 0.20688 -0.1
-1.68178 0.06895 -0.1
-1.68178 -0.06898 -0.1
-1.66831 -0.20691 -0.1
-1.63979 -0.34484 -0.1
-1.59273 -0.48277 -0.1
-1.58621 -0.497159 -0.1
-1.5338 -0.6207 -0.1
-1.44828 -0.758597 -0.1
-1.33896 -0.89656 -0.1
-1.31035 -0.926474 -0.1
-1.18365 -1.03449 -0.1
-1.17242 -1.04332 -0.1
-1.03449 -1.12811 -0.1
-0.914331 -1.17242 -0.1
-0.89656 -1.17953 -0.1
-0.75863 -1.20736 -0.1
-0.6207 -1.20275 -0.1
-0.527497 -1.17242 -0.1
-0.48277 -1.15932 -0.1
-0.34484 -1.05956 -0.1
-0.326174 -1.03449 -0.1
-0.239061 -0.89656 -0.1
-0.20691 -0.828301 -0.1
-0.185154 -0.75863 -0.1
-0.152369 -0.6207 -0.1
-0.130278 -0.48277 -0.1
-0.115783 -0.34484 -0.1
-0.107 -0.20691 -0.1
-0.102853 -0.06898 -0.1
-0.102852 0.06895 -0.1
-0.106999 0.20688 -0.1
-0.115781 0.34481 -0.1
-0.130274 0.48274 -0.1
-0.152364 0.62067 -0.1
-0.185147 0.7586 -0.1
-0.20691 0.828304 -0.1
-0.23904 0.89653 -0.1
-0.326158 1.03446 -0.1
-0.34484 1.05955 -0.1
-0.48277 1.15932 -0.1
-0.527396 1.17239 -0.1
-0.6207 1.20275 -0.1
-0.75863 1.20736 -0.1
-0.89656 1.17953 -0.1
# Contour 6, label: -0.2
-0.89656 0.83561 -0.2
-1.03212 0.7586 -0.2
-1.03449 0.757115 -0.2
-1.17242 0.627578 -0.2
-1.17822 0.62067 -0.2
-1.27175 0.48274 -0.2
-1.31035 0.3997 -0.2
-1.33456 0.34481 -0.2
-1.37413 0.20688 -0.2
-1.3928 0.06895 -0.2
-1.3928 -0.06898 -0.2
-1.3741 -0.20691 -0.2
-1.33452 -0.34484 -0.2
-1.31035 -0.399632 -0.2
-1.27172 -0.48277 -0.2
-1.17822 -0.6207 -0.2
-1.17242 -0.627606 -0.2
-1.03449 -0.757113 -0.2
-1.03207 -0.75863 -0.2
-0.89656 -0.835615 -0.2
-0.75863 -0.871188 -0.2
-0.6207 -0.865294 -0.2
-0.48277 -0.80599 -0.2
-0.434266 -0.75863 -0.2
-0.34484 -0.652396 -0.2
-0.329265 -0.6207 -0.2
-0.276228 -0.48277 -0.2
-0.241423 -0.34484 -0.2
-0.220334 -0.20691 -0.2
-0.210379 -0.06898 -0.2
-0.210377 0.06895 -0.2
-0.220333 0.20688 -0.2
-0.24142 0.34481 -0.2
-0.276223 0.48274 -0.2
-0.329258 0.62067 -0.2
-0.34484 0.652384 -0.2
-0.43424 0.7586 -0.2
-0.48277 0.805988 -0.2
-0.6207 0.86529 -0.2
-0.75863 0.871183 -0.2
-0.89656 0.83561 -0.2
# Contour 7, label: -0.3
-0.89656 0.537758 -0.3
-0.963546 0.48274 -0.3
-1.03449 0.405778 -0.3
-1.07456 0.34481 -0.3
-1.13323 0.20688 -0.3
-1.16092 0.06895 -0.3
-1.16092 -0.06898 -0.3
-1.13322 -0.20691 -0.3
-1.07456 -0.34484 -0.3
-1.03449 -0.405808 -0.3
-0.963519 -0.48277 -0.3
-0.89656 -0.537754 -0.3
-0.75863 -0.592534 -0.3
-0.6207 -0.58346 -0.3
-0.48277 -0.492156 -0.3
-0.476122 -0.48277 -0.3
-0.402187 -0.34484 -0.3
-0.357389 -0.20691 -0.3
-0.34484 -0.126349 -0.3
-0.338765 -0.06898 -0.3
-0.338765 0.06895 -0.3
-0.34484 0.126334 -0.3
-0.357384 0.20688 -0.3
-0.402179 0.34481 -0.3
-0.476092 0.48274 -0.3
-0.48277 0.49217 -0.3
-0.6207 0.583472 -0.3
-0.75863 0.592531 -0.3
-0.89656 0.537758 -0.3
# Contour 8, label: -0.4
-0.75863 0.247435 -0.4
-0.808634 0.20688 -0.4
-0.893406 0.06895 -0.4
-0.893406 -0.06898 -0.4
-0.808586 -0.20691 -0.4
-0.75863 -0.247423 -0.4
-0.6207 -0.228129 -0.4
-0.604222 -0.20691 -0.4
-0.550252 -0.06898 -0.4
-0.550252 0.06895 -0.4
-0.604208 0.20688 -0.4
-0.6207 0.228119 -0.4
-0.75863 0.247435 -0.4

View file

@ -0,0 +1,33 @@
SOURCE = 3d-gradient-colored
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex -shell-escape $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot *.script *.dat
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,10 @@
Compiled example
----------------
![Example](3d-gradient-colored.png)
Creation
--------
* Make sure that `gnuplot` is installed and in your PATH.
* You can let Wolfram|Alpha calculate you gradients (http://www.wolframalpha.com/input/?i=gradient+of+x%2F%28e%5E%28x%5E2%2By%5E2%29%29)
* See http://en.wikibooks.org/wiki/LaTeX/Colors for colors