Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am making a 3D surfplot in pgfplots, and my situation is described by the following 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}

I wish to manually decide what the limits on the z-axis should be, regardless of what the coordinate-values are. E.g. I want to force them to be {0, 0.1}. Is there a way to accomplish this in pgfplots?

Best, Niles.

share|improve this question
2  
do you mean zmin and zmax? –  cmhughes Oct 29 '12 at 21:39
    
you are right, thanks –  BillyJean Oct 29 '12 at 23:18
add comment

1 Answer

up vote 3 down vote accepted

As noted by Chris (cmhughes), you can set the limits xmin and zmax for the plot when you \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}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.