Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. documentclass[border=5mm]{standalone}
  2. usepackage{pgfplots}
  3. usepackage{tikz}
  4. pgfdeclarefunctionalshading{sphere}{pgfpoint{-25bp}{-25bp}}{pgfpoint{25bp}{25bp}}{}{
  5. %% calculate unit coordinates
  6. 25 div exch
  7. 25 div exch
  8. %% copy stack
  9. 2 copy
  10. %% compute -z^2 of the current position
  11. dup mul exch
  12. dup mul add
  13. 1.0 sub
  14. %% and the -z^2 of the light source
  15. 0.3 dup mul
  16. -0.5 dup mul add
  17. 1.0 sub
  18. %% now their sqrt product
  19. mul abs sqrt
  20. %% and the sum product of the rest
  21. exch 0.3 mul add
  22. exch -0.5 mul add
  23. %% max(dotprod,0)
  24. dup abs add 2.0 div
  25. %% matte-ify
  26. 0.6 mul 0.4 add
  27. %% currently there is just one number in the stack.
  28. %% we need three corresponding to the RGB values
  29. dup
  30. 0.4
  31. }
  32. begin{document}
  33. begin{tikzpicture}
  34. begin{axis}[ axis lines=center, axis on top = false,
  35. view={140}{25},axis equal,title={The Mexican hat potential},
  36. colormap={blackwhite}{gray(0cm)=(1); gray(1cm)=(0)},
  37. samples=50,
  38. domain=0:360,
  39. y domain=0:1.25,
  40. zmin=0,
  41. xmax=1.5,
  42. ymax=1.5,
  43. zmax=1.5,
  44. x label style={at={(axis description cs:0.10,0.25)},anchor=north},
  45. y label style={at={(axis description cs:0.9,0.2)},anchor=north},
  46. z label style={at={(axis description cs:0.5,0.9)},anchor=north},
  47. xlabel = $mathrm{Re}(phi)$,
  48. ylabel=$mathrm{Im}(phi)$,
  49. zlabel=$V(phi)$,
  50. yticklabels={,,},
  51. xticklabels={,,},
  52. zticklabels={,,}
  53. ]
  54. addplot3 [surf, shader=flat, draw=black, fill=white, z buffer=sort] ({sin(x)*y}, {cos(x)*y}, {(y^2-1)^2});
  55. end{axis}
  56. shade[shading=sphere] (3.47,3.5) circle [radius=0.15cm];
  57. shade[shading=sphere] (5.2,2.2) circle [radius=0.15cm];
  58. node[anchor=east] at (4.05,3.71) (text) {A};
  59. node[anchor=west] at (5.5,3.0) (description) {B};
  60. draw (description) edge[out=180,in=0,<-] (text);
  61. end{tikzpicture}
  62. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement