2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/tikz/3d-gradient-cos/3d-gradient-cos.tex
2018-12-31 20:42:26 +01:00

47 lines
1.3 KiB
TeX

\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{pgfplots}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{preview}
\pgfplotsset{
colormap={whitered}{
color(0cm)=(white);
color(1cm)=(orange!75!red)
}
}
\begin{tikzpicture}
\begin{axis}[
colormap name=whitered,
width=15cm,
view={45}{45},
enlargelimits=false,
grid=major,
domain=-90:90,
y domain=-90:90,
% ymode=log,
samples=46, %57 : TeX capacity exceeded, sorry [main memory size=3000000].
% see also http://tex.stackexchange.com/a/7954/5645
% zlabel=f,
%colorbar,
%colorbar style={
% at={(-0.1,0)},
% anchor=south west,
% height=0.25*\pgfkeysvalueof{/pgfplots/parent axis height},
% title={$f(x,y)$}
%}
]
%\addplot3[patch,patch type=bilinear,mesh,black] {0};
\addplot3[blue,/pgfplots/quiver,
quiver/u=4 * sin(x) * cos(x) * (cos(x)^2 + cos(y)^2),
quiver/v=4 * sin(y) * cos(y) * (cos(x)^2 + cos(y)^2),
quiver/w=0,
quiver/scale arrows=4,
-stealth,samples=15] {-4};
\addplot3[surf,opacity=0.9] {-(cos(x)^2 + cos(y)^2)^2};
\end{axis}
\end{tikzpicture}
\end{preview}
\end{document}