我正在尝试使用 Pgftools 绘制 3D 图形 y=4x^2+z^2,但无法在函数中使用 z 作为独立变量。
\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}
答案1
x
和y
只是占位符。您可以添加参数图。
\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}