TikZ and pgfplots
A plot and a drawing
figuresplotsDownload (ZIP)Source on GitHub
Preview
tikz.tex
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\section*{TikZ and pgfplots}
\emph{In this preview:} TikZ and pgfplots pictures are not drawn yet; each shows as a placeholder with its
source. A full LaTeX run draws them.
\begin{center}
\begin{tikzpicture}
\begin{axis}[xlabel={$x$}, ylabel={$y$}, domain=-2:2, samples=50, legend pos=north west]
\addplot[blue, thick] {x^2};
\addlegendentry{$x^2$}
\addplot[red, dashed] {x^3};
\addlegendentry{$x^3$}
\end{axis}
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}
\draw[->] (-0.2,0) -- (3,0) node[right] {$x$};
\draw[->] (0,-0.2) -- (0,2) node[above] {$y$};
\draw[thick, blue] (0,0) circle (1cm);
\fill[red] (1,1) circle (2pt) node[above right] {$(1,1)$};
\end{tikzpicture}
\end{center}
\end{document}
Files
tikz.tex(854 bytes)