# Plotting parametric, scalar-valued function over parametric surface using pgfplots

I think this is a relatively simple question but I can't seem to find the answer anywhere.

Suppose I have the following set of parametric equations for a cylinder:

X(s,t) = cos(s), Y(s,t) = sin(s), Z(s,t) = t

that I can plot using the following snippet of code:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}

\begin{document}
\begin{tikzpicture}
\begin{axis}
samples=25,
z buffer = sort,
domain = 0:2*pi,
y domain = 0:1]({cos(deg(x))}, {sin(deg(x)}, {y});
\end{axis}
\end{tikzpicture}

\end{document}


that generates the following figure: I would like to change the color shading from what is currently the z-value to some other parametric function, say w(s,t)=1+5*s^2+exp(t). I've tried using the declare function feature in pgfplots along with point meta but have had no luck. This seems like it should be something that's fairly straight-forward but it's proving to be quite difficult. I'm also fairly new to tikz/pgfplots which may explain it.

Thanks!

Welcome to TeX-SE! I may be missing something but I just spelled out what you seem to be trying and it works here.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}

\begin{document}
\begin{axis}
samples=25,
z buffer = sort,
domain = 0:2*pi,
y domain = 0:1, • @JBenzaken One simple way to get the parameters is to invert the function, e.g. point meta={myshader(atan2(rawy,rawx),rawz)}]({cos(deg(x))}, {sin(deg(x)}, {y});. – user121799 May 28 '19 at 15:58
• @JBenzaken I do not know out of the top of my head, and it might be less trivial than you think it should be because of the way coordinates are parsed. (Note that some things not discussed in the manual is explained in detail in pgfplotscoordprocessing.code.tex.) – user121799 May 28 '19 at 22:00