ellipsoid.tex 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{pgfplots}
  5. \usepackage{units}
  6. \pgfplotsset{compat=1.3}% <-- moves axis labels near ticklabels
  7. % (respects tick label widths)
  8. \usepackage{tikz}
  9. \usetikzlibrary{arrows, positioning, calc, intersections, decorations.markings}
  10. \usepackage{xcolor}
  11. \definecolor{horizontalLineColor}{HTML}{008000}
  12. \definecolor{verticalLineColor}{HTML}{FF0000}
  13. \begin{document}
  14. % Define this as a command to ensure that it is same in both cases
  15. \newcommand*{\ShowIntersection}[2]{
  16. \fill
  17. [name intersections={of=#1 and #2, name=i, total=\t}]
  18. [red, opacity=1, every node/.style={above left, black, opacity=1}]
  19. \foreach \s in {1,...,\t}{(i-\s) circle (2pt)
  20. node [above left] {\s}};
  21. }
  22. \begin{preview}
  23. \begin{tikzpicture}
  24. \begin{axis}[
  25. grid=both,
  26. minor tick num=1,
  27. xlabel=$x$,
  28. ylabel=$y$,
  29. zlabel=$z$,
  30. %label distance=0mm,
  31. %width=8cm, height=7cm, % size of the image
  32. axis lines=left,
  33. %tick style={draw=none},
  34. %xticklabels={,,},
  35. %yticklabels={,,}
  36. ]
  37. \addplot3[surf, colormap name=viridis] {-(x*x/16+y*y/4-1)};
  38. \end{axis}
  39. \end{tikzpicture}
  40. \end{preview}
  41. \end{document}