Hi Christian, adding 'axis equal' helps somewhat but the image remains an ellipsoid.
An orthogonal projection of a sphere in any direction should
look like a circle, shouldn't it? What I am getting in pgfplots
is not a circle. I have attached a sample image produced by
the following code:
\documentclass{article}
\usepackage{pgfplots}
%\usepgfplotslibrary{external}
%\tikzexternalize
\begin{document}
\begin{tikzpicture}
\begin{axis}[view={60}{30}, axis equal=true]
\addplot3[surf, z buffer=sort, domain=0:180, y domain=0:360]
({sin(x)*cos(y)},
{sin(x)*sin(y)},
{cos(x)}
);
\end{axis}
\draw (3.45,2.85) circle(1.8); % for comparison
\end{tikzpicture}
\end{document}
Rouben
PS: Changing the view option to `view={45}{0}' produces even
a more drastic illustration of the flattening of the sphere.
---- original message -------------------------------------------
From: Christian Feuersaenger <[email protected]>
Date: Wed, 25 Apr 2012 20:37:41 +0200
To: Rouben Rostamian <[email protected]>, 'PGFplots mailing list'
<[email protected]>
Subject: Re: Plotting a sphere in pgfplots
Hi Rouben,
the result actually *is* a sphere - but the coordinate system is
skewed because the axes do not have the same units.
The option 'axis equal' for \begin{axis} will fix it.
Best regards
Christian
Am 24.04.2012 03:58, schrieb Rouben Rostamian:
>Hello Christian,
>
>I have a rather basic question about pgfplots.
>I am trying to plot a sphere, like this:
>
>\documentclass{article}
>\usepackage{pgfplots}
>\begin{document}
>\begin{tikzpicture}
> \begin{axis}[view={60}{30}]
> \addplot3[surf, z buffer=sort, domain=0:180, y domain=0:360]
> ({sin(x)*cos(y)},
> {sin(x)*sin(y)},
> {cos(x)}
> );
> \end{axis}
>\end{tikzpicture}
>\end{document}
>
>The result appears to be an ellipsoid rather than a sphere.
>(I am using pgfplots 1.4.1.) I suspect that I have failed
>to specify an essential parameter. I searched the manual
>but didn't find the necessary information. Would you please
>tell me how to make a sphere that looks like a sphere?
>
>Rouben
>
>
t-figure0.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Pgfplots-features mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pgfplots-features
