cylinder.tex 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. \documentclass[border=2pt]{standalone}
  2. \usepackage{pgfplots}
  3. \pgfplotsset{compat=1.9} %It is possible to remove this line, but you will get a warning
  4. \begin{document}
  5. \pgfplotsset{
  6. colormap={whitered}{
  7. color(0cm)=(white);
  8. color(1cm)=(orange!75!red)
  9. }
  10. }
  11. \begin{tikzpicture}
  12. \begin{axis}[
  13. colormap name=whitered,
  14. width=15cm,
  15. view={340}{25},
  16. enlargelimits=false,
  17. grid=major,
  18. domain=0:5,
  19. y domain=0:2*pi,
  20. xmin=-1.5, xmax=1.5,
  21. ymin=-1.5, ymax=1.5, zmin=0.0,
  22. samples=30, %57 : TeX capacity exceeded, sorry [main memory size=3000000].
  23. % see also http://tex.stackexchange.com/a/7954/5645
  24. xlabel=$x$,
  25. ylabel=$y$,
  26. zlabel={$z$},
  27. %colorbar,
  28. colorbar style={
  29. at={(-0.1,0)},
  30. anchor=south west,
  31. height=0.25*\pgfkeysvalueof{/pgfplots/parent axis height},
  32. title={$f(x,y)$}
  33. }
  34. ]
  35. \addplot3 [surf,z buffer=sort] ({cos(deg(y))},{sin(deg(y))},{x});
  36. \end{axis}
  37. \end{tikzpicture}
  38. \end{document}