答案1
这是一些入门知识。我不确定我是否准确地复制了您的图形---我围绕 y 轴旋转了小方块以重新创建图形。我尝试将轴涂成红色,以使它们在平面上更加突出。
\documentclass[tikz, border=1mm]{standalone}
\begin{document}
\def\h{0.38}
\begin{tikzpicture}[
point/.style = {inner sep=1pt, fill=gray},
y={(-10:1cm)},
x={(205:0.8cm)},
z={(90:0.8cm)},
scale=0.7,
axis/.style = {
red!75!black,
->
}
]
\foreach \x in {-5, ..., 5} {
\foreach \y [
evaluate=\y as \t using 65*\y/5,
evaluate=\t as \s using -sin(\t),
evaluate=\t as \c using cos(\t),
] in {-5, ..., 5} {
\draw[fill=gray!30]
(\x +\c*\h, \y - \h, -\s*\h) --
(\x +\c*\h, \y + \h, -\s*\h) --
(\x -\c*\h, \y + \h, \s*\h) --
(\x -\c*\h, \y - \h, \s*\h) -- cycle;
}
}
\draw[axis] (-7, 0, 0) -- (7, 0, 0) node[below right] {$x$};
\draw[axis] ( 0,-8, 0) -- (0, 8, 0) node[above] {$y$};
\draw[axis] ( 0, 0,-4) -- (0, 0, 4) node[right] {$z$};
\end{tikzpicture}
\end{document}
答案2
使用 pgfplots。
输出
代码
\documentclass[12pt,tikz,border=0pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
[
declare function={alpha(\x,\y) = \y*\x;}
]
\def\a{1.2}
\def\b{.5}
\def\delt{.08}
\begin{axis}
[
height=10cm,
samples = 2,
samples y = 2,
axis lines = center,
xmin=-\a, xmax=\a,
ymin=-\a, ymax=\a,
zmin = -\b, zmax = \b,
domain = -\delt:\delt, domain y = -\delt:\delt,
ticks=none,
]
\foreach \xx in {-1,-.8,...,1}
{
\foreach \yy in {-1,-.8,...,1}
{
\addplot3[surf,faceted color=black, fill=gray!30, opacity=.5] ({x+\xx},{y+\yy},{alpha(x,\yy)});
}
}
\end{axis}
\end{tikzpicture}
\end{document}