我想在 3D 系统中绘制函数x=-3
。我在网上搜索了几个小时,找到了这个例子:
\begin{tikzpicture}[
declare function = {
X1(\y,\z) = -3;
}]
\begin{axis}[grid,
x={(-0.7071cm,-0.7071cm)},
y={(1cm,0.0cm)},
z={(0cm,1cm)},
axis lines=center,
font=\footnotesize,
xmax=5.4,ymax=5.4,zmax=5.4,
xmin=-5.4,ymin=-5.4,zmin=-5.4,
xlabel=\normalsize$x$,ylabel=\normalsize$y$,zlabel=\normalsize$z$,
major tick style = {black},
minor tick num=1, minor tick style = {very thin},
axis line style = {-latex}, %Pfeilspitzen
%enlargelimits=0.1
% Ebene x=-3
\addplot3 [color=red, surf, semitransparent] {X1(y,z)};
\end{axis}
\end{tikzpicture}
我得到这个例子的例子是z=5
,现在我想绘制这个新代码,但它不起作用。当我把z
以下包放在任何地方时,PGF数学错误无法解析''作为浮点数。系统是否可能不将z视为变量?我没有其他想法......谢谢帮助
答案1
对于 3d 图,您需要具有三个坐标的点;{X1(y,z)}
只是一个组件。此外,变化的参数称为x
和y
。
\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}%
[declare function = { X1(\y,\z) = -3;} ]
\begin{axis}%
[grid,
% x={(-0.7071cm,-0.7071cm)},
% y={(1cm,0.0cm)},
% z={(0cm,1cm)},
axis lines=center,
font=\footnotesize,
xmax=5.4,ymax=5.4,zmax=5.4,
xmin=-5.4,ymin=-5.4,zmin=-5.4,
xlabel={\normalsize$x$},
ylabel={\normalsize$y$},
zlabel={\normalsize$z$},
major tick style = {black},
minor tick num=1, minor tick style = {very thin},
axis line style = {-latex},
]
\addplot3 [color=red, surf, semitransparent] ({X1(x,y)},x,y);
\end{axis}
\end{tikzpicture}
\end{document}