如果我绘制此图,z 轴不会从 0 开始,而是从负数开始。我该如何解决这个问题?
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\pgfplotsset{
colormap={whitered}{
color(0cm)=(white);
color(1cm)=(orange!75!red)
}
}
\begin{tikzpicture}
\begin{axis}[%
%axis equal,
colormap name=whitered,
width=20cm,
view={340}{25},
enlargelimits=false,
grid=major,
%domain=-10:1,
%y domain=-1:1,
samples=41, %57
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zmin=0.0,
yticklabels={,,},
xticklabels={,,},
%zticklabels={,,},
]
\addplot3[thick, draw=red, mark=*, fill=orange, opacity=0.2] coordinates {(1,1,0)(-1,1,0)(-1,-1,0)(1,-1,0)(1,1,0)};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
杰克在他的评论。一个快速的解决方法是也指定,zmax
例如。axis
zmax=1