我有一个3D-情节产生
正确的缩放方法是什么x 轴和 y 轴这样立方体0,1,2,3粘在一起?像这样:
\documentclass[border=10pt, varwidth]{standalone}
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\pgfplotstableread[col sep=comma,header=true]{
X, Y, Z
0, 0, 0
1, 0, 0
2, 0, 0
1, -1, 0
4, 0, 0
}{\datatable}
\begin{tikzpicture}
\begin{axis}[
%xmin=0, xmax=6,
ymin=-1, ymax=1,
zmin=0, zmax=1,
grid=both,
point meta=explicit, % colors 1/2
xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
% x=3mm, y=1cm, z=1cm, % not a good idea
]
\addplot3[scatter, mark=*, only marks,
mark=cube*, mark size=7,
nodes near coords*=\coordindex,
] table [x=X, y=Y,z=Z,
meta expr={\thisrow{X}} % colors 2/2
] {\datatable};
\end{axis}
\end{tikzpicture}
\end{document}