# Axes and a function

> Two arrows for the axes and one plotted function: the plainest graph to start from. A Functions and calculus example with its LaTeX source.

A Functions and calculus example in the TeXeR TikZ library: https://texer.org/library/calculus/simple-axes

Package: [Functions and calculus](https://texer.org/library/calculus.md), on CTAN at https://ctan.org/pkg/pgf.

Tags: axes, function, plot

## Source

```latex
\begin{tikzpicture}[domain=-2:2, samples=50]
  \draw[->] (-2.5,0) -- (2.5,0) node[right] {$x$};
  \draw[->] (0,-0.5) -- (0,4.5) node[above] {$y$};
  \draw[thick] plot (\x, {\x*\x}) node[right] {$y = x^2$};
\end{tikzpicture}
```

## As a complete document

The same example in a document that compiles on its own with pdfLaTeX:

```latex
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
\begin{tikzpicture}[domain=-2:2, samples=50]
  \draw[->] (-2.5,0) -- (2.5,0) node[right] {$x$};
  \draw[->] (0,-0.5) -- (0,4.5) node[above] {$y$};
  \draw[thick] plot (\x, {\x*\x}) node[right] {$y = x^2$};
\end{tikzpicture}
\end{document}
```
