[Tex/LaTex] Rotate 3D plot to top down view

3dpgfplotstikz-pgf

I have a function with 2 parameters that, when plotted in 3D, is rotated in such a way that a part of the surface is hidden:

3D Plot

\begin{tikzpicture}[
declare function={
    func(\x, \y) = ((\x<10) * (\x/10) + (\x>=10)) *
    ((\y<=30) * (\y/30) + (\y>30) * (1- (\y-30)/((\y-30)+3)));
}
]
\begin{axis}[
colormap name=whitered,
axis z line=middle,
xmin=0, xmax=50, xlabel=$d$,
ymin=0, ymax=30, ylabel=$v$,
zmin=0, zmax=1.1, zlabel=$\overline{f}$
]
\addplot3[domain=0:50, y domain=0:30, samples=50, surf] {func(\x, \y)};
\end{axis}
\end{tikzpicture}

To prevent this I would like to plot it from a "top-down" view and then rely purely on colors to indicate the value of the function. How can this be done?

Best Answer

The option /pgfplots/view={azimuth}{elevation} will help you with that

\documentclass[border = 5pt]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[
  declare function={
    func(\x, \y) = ((\x<10) * (\x/10) + (\x>=10)) *
    ((\y<=30) * (\y/30) + (\y>30) * (1- (\y-30)/((\y-30)+3)));
  }
  ]
  \begin{axis}[
    view={-70}{50},
    %axis z line=middle,
    xmin=0, xmax=50, xlabel=$d$,
    ymin=0, ymax=30, ylabel=$v$,
    zmin=0, zmax=1.1, zlabel=$\overline{f}$,
    ]
    \addplot3[domain=0:50, y domain=0:30, samples=50, surf] {func(\x, \y)};
  \end{axis}
\end{tikzpicture}

\end{document}

enter image description here