Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
1
\documentclass{article}
2
\usepackage[pdftex,active,tightpage]{preview}
3
\setlength\PreviewBorder{2mm}
4
\usepackage{pgfplots}
5
\usepgfplotslibrary{patchplots}
6
7
\begin{document}
8
\begin{preview}
9
\pgfplotsset{
10
colormap={whitered}{
11
color(0cm)=(white);
12
color(1cm)=(orange!75!red)
13
}
14
}
15
\begin{tikzpicture}
16
\begin{axis}[
17
colormap name=whitered,
18
width=15cm,
19
view={45}{45},
20
enlargelimits=false,
21
grid=major,
22
domain=-90:90,
23
y domain=-90:90,
24
% ymode=log,
25
samples=46, %57 : TeX capacity exceeded, sorry [main memory size=3000000].
26
% see also http://tex.stackexchange.com/a/7954/5645
27
% zlabel=f,
28
%colorbar,
29
%colorbar style={
30
% at={(-0.1,0)},
31
% anchor=south west,
32
% height=0.25*\pgfkeysvalueof{/pgfplots/parent axis height},
33
% title={$f(x,y)$}
34
%}
35
]
36
%\addplot3[patch,patch type=bilinear,mesh,black] {0};
37
\addplot3[blue,/pgfplots/quiver,
38
quiver/u=4 * sin(x) * cos(x) * (cos(x)^2 + cos(y)^2),
39
quiver/v=4 * sin(y) * cos(y) * (cos(x)^2 + cos(y)^2),
40
quiver/w=0,
41
quiver/scale arrows=4,
42
-stealth,samples=15] {-4};
43
\addplot3[surf,opacity=0.9] {-(cos(x)^2 + cos(y)^2)^2};
44
\end{axis}
45
\end{tikzpicture}
46
\end{preview}
47
\end{document}
48
49