1

I am trying to 3D plot y=4x^2+z^2 using Pgftools but I'm unable to use z as an independent variable in the function.

\begin{tikzpicture}[scale=1.5]
\begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
\addplot3 [
surf,
shader=faceted,
samples=20,
] {x^2+z^2};
\end{axis}
\end{tikzpicture}
  • Welcome to TeX.SX! Please help us help you by making your code snippet compilable (a MWE). – TeXnician Feb 27 at 17:11
  • 1
    x and y are just placeholders. You can add a parametric plot. – marmot Feb 27 at 17:12
3

x and y are just placeholders. You can add a parametric plot.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
\addplot3 [
surf,
shader=faceted,
samples=20,
] ({x},{4*x^2+y^2},{y});
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.