我正在 pgfplots 中制作 3D surfplot,我的情况由以下 MWE 描述:
\documentclass{article}
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\pgfplotsset{width=12.5cm,height=8.75cm, grid style=dashed, tick label style={font=\Large}, label style={font=\Large}}
\usepgfplotslibrary{external}
\tikzexternalize[shell escape=-enable-write18] %needed for the MiKTeX compiler
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both, xlabel=\Large{$x$},ylabel=\Large{$y$}, zlabel=\Large{$z$}, view/v=55]
\addplot3[surf] coordinates{(0,0,0) (1,0,0) (2,0,0) (3,0,0) (0,1,0) (1,1,0.6) (2,1,0.7) (3,1,0.5) (0,2,0) (1,2,0.7) (2,2,0.8) (3,2,0.5) };
\end{axis}
\end{tikzpicture}
\end{document}
我希望手动确定 z 轴上的限值,而不管坐标值是多少。例如,我想强制它们为 {0, 0.1}。有没有办法在 pgfplots 中实现这一点?
最好的,尼尔斯。
答案1
正如克里斯 (cmhughes) 所说,您可以在 时为情节设置限制xmin
和。zmax
\begin{axis}
\documentclass{article}
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\pgfplotsset{width=12.5cm,height=8.75cm, grid style=dashed, tick label style={font=\Large}, label style={font=\Large}}
%\usepgfplotslibrary{external}
%\tikzexternalize[shell escape=-enable-write18] %needed for the MiKTeX compiler
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both, xlabel=\Large{$x$},ylabel=\Large{$y$}, zlabel=\Large{$z$}, view/v=55,zmin=0,zmax=.1]
\addplot3[surf] coordinates{(0,0,0) (1,0,0) (2,0,0) (3,0,0) (0,1,0) (1,1,0.6) (2,1,0.7) (3,1,0.5) (0,2,0) (1,2,0.7) (2,2,0.8) (3,2,0.5) };
\end{axis}
\end{tikzpicture}
\end{document}