[Tex/LaTex] Changing view angle distorts sphere with pgfplots

3dpgfplots

I am trying to learn how to use pgfplots by plotting simple things, like a two-dimensional sphere. However, I find it quite surprising that depending on the view angle, the result sometimes does not look like a sphere at all. Unless I am missing something, a sphere should like the same no matter which direction we are looking from.

Here is my example code:

\documentclass[a4paper,landscape]{article}

\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{width=6cm}

\newcommand{\degree}{\ensuremath{^\circ}}
\newcommand{\plotsphere}[2]{
\begin{axis}[view={#2}{#1},axis equal,title={$\theta=#1\degree,\quad \phi=#2\degree$}]
\addplot3[surf,shader=flat,z buffer=sort,
samples=20,domain=-1:1,y domain=0:2*pi]
({sqrt(1-x^2) * cos(deg(y))},
{sqrt( 1-x^2 ) * sin(deg(y))},
x);
\end{axis}
}

\begin{document}
\pagestyle{empty}
\begin{figure}
\begin{tikzpicture}[scale = 0.75]
\foreach \x/\polangle in {-8/20,0/45,8/70}
    \foreach \y / \azangle in {-8/20,0/45,8/70}
        \node at (\x,\y) {\plotsphere{\polangle}{\azangle}};
\end{tikzpicture}
\end{figure}
\end{document}

and the result:

enter image description here

The only version I am satisfied with is view={45}{45}. All the other ones appear distorted. It seems that this distortion does not come from different length units on the axis because I am using the axis equal option. Am I forgetting some important parameter?

Best Answer

As Luigi correctly states, it was a bug which has been fixed in the 1.6 version.

Therefore an update will solve your problem. For the record try and see the difference between axis equal and axis equal image in the following figures.

No axis scaling

Of course here the scaling is wrong.

enter image description here

axis equal option

Here the scaling is correct. It will scale the axis limits so that it keeps the width and height that has been specified (that is <axis>min and <axis>max are subjected to the scaling). Hence you will see that it has tendencies to fill with a lot of white space if one does not have correct spacings (notice that in \theta=45).

enter image description here

axis equal image option

The scaling is also correct here. However, here the <axis>min and <axis>max are not the scaling parameters. Instead the width and height of the image is matched that of the found <axis>min and <axis>max lengths. Thus the image size will not be retained, even if specified.

enter image description here