Example: Function visualization

Published 2014-03-15 | Author: Christian Feuersänger

We want to visualize two functions. The first function is given by means of a data table. The second function is given by means of a math expression. We would like to place the two results side-by-side, and we would like to have “proper” alignment.

The code is from the PGFPlots 1.10 manual: “3.2 Solving a Real Use Case: Function Visualization”.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Function visualization

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\begin{document}
\begin{tikzpicture}[baseline]
\begin{axis}[
   title=Inv. cum. normal,
   xlabel={$x$},
   ylabel={$y$},
   ymin=-3, ymax=3,
   minor y tick num=1,
]
\addplot[blue] table {invcum.dat};
\end{axis}
\end{tikzpicture}%
%
\hskip 10pt % insert a non-breaking space of specified width.
%
\begin{tikzpicture}[baseline]
\begin{axis}[
   yticklabel pos=right,
]
% density of Normal distribution:
\newcommand\MU{0}
\newcommand\SIGMA{1e-3}
\addplot[red,domain=-3*\SIGMA:3*\SIGMA,samples=201]
   {exp(-(x-\MU)^2 / 2 / \SIGMA^2) / (\SIGMA * sqrt(2*pi))};
\end{axis}
\end{tikzpicture}
\end{document}

Comments

Adding comments is currently not enabled.

There are currently 0 comments on this entry.

Features
Tags
Scientific and technical areas

Creative Commons License