x-3-cubic-function.tex 992 B

12345678910111213141516171819202122232425262728293031323334
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{pgfplots}
  3. \usepackage{tikz}
  4. \begin{document}
  5. \begin{tikzpicture}
  6. \begin{axis}[
  7. legend pos=south east,
  8. axis x line=middle,
  9. axis y line=middle,
  10. grid = major,
  11. width=8cm,
  12. height=12cm,
  13. grid style={dashed, gray!30},
  14. xmin=-2, % start the diagram at this x-coordinate
  15. xmax= 2, % end the diagram at this x-coordinate
  16. ymin=-8, % start the diagram at this y-coordinate
  17. ymax= 8, % end the diagram at this y-coordinate
  18. axis background/.style={fill=white},
  19. xlabel=x,
  20. ylabel=y,
  21. %xticklabels={-2,-1.6,...,2},
  22. %yticklabels={-8,-7,...,8},
  23. tick align=outside,
  24. enlargelimits=true,
  25. tension=0.08]
  26. % plot the stirling-formulae
  27. \addplot[domain=-2:2, red, thick,samples=500] {x*x*x};
  28. \addlegendentry{$f(x)=x^3$}
  29. \end{axis}
  30. \end{tikzpicture}
  31. \end{document}