I'm a newcomer to LaTeX and pgfplots. And now I found a problem while I was using \addplot3
. It seems that the image behaved abnormally on perspective.This is the image generated.
For reference I changed to view={20}{0}
, and it became the image below.
Could anyone tell me how to deal with it, please? I don't know how to make the first image right. My tex code is
%!TEX program = xelatex
\documentclass{article}
\usepackage{fontspec, xunicode, xltxtra, pgfplots}
\setmainfont{Hiragino Sans GB}
\pgfplotsset{compat=1.8}
\title{Title}
\author{}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
title={$x \exp(-x^2-y^2)$},
xlabel=$x$, ylabel=$y$,
small,
view={20}{30}
] \addplot3[surf,mesh/cols=50,domain=-2:2,domain y=-1.3:1.3]
table {2.dat};
\end{axis}
\end{tikzpicture}
\caption{a small example}
\end{figure}
\end{document}
THANKS!
z buffer=sort
in your\addplot3 [...]
options.z buffer= sort
?{x*exp(-x*x-y*y)}
, I could not reproduce the behavior...pgfplots
. Could you provide the data file2.dat
?pgfplots
is supposed to draw plots like that correctly out of the box and I will see what I can do. If the file is too long (looks like 50x50), you can send it by mail (my address is in on top of the pgfplots manual).