# Example: Surface Plot

Published 2014-03-15 | Author: Christian FeuersÃ¤nger

We have two functions for which we seek a plot: the first is a sampled function given by a huge data file and the second is the math expression g(x,y) = exp(-x^2 - y^2) * x.

Our first function actually consists of two data files: the first file contains some scattered data which is used to discretized (“sample”) a function and the second file contains data for the function as such. Our requirement here is two draw two graphs into the same axis: one in which the function is plotted as a smooth, colored surface and one in which the scattered data file should be on top of the surface because it provides more detail how the function was represented in the computer.

The second function which is given as math expression should be visualized using a contour plot.

The code is from the PGFPlots 1.10 manual: “3.5 Solving a Real Use-Case: Functions of Two Variables”.

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}
\begin{axis}[
view/h=40,
colorbar horizontal,
xlabel=$x$, ylabel=$y$,
]
table {concat_VV_together.dat};
\end{axis}
\end{tikzpicture}
\end{document}